Add unit tests for `--quote`

This commit is contained in:
Scott Baker 2023-08-23 15:54:36 -07:00
parent 6cfdd45dc5
commit 9bf0306725
1 changed files with 22 additions and 0 deletions

View File

@ -76,6 +76,14 @@ fn test_simple() {
);
}
static AND_QUOTE_FILES: &[&str] = &[
"one'two.quo",
"one two.quo",
"one\"two.quo",
"one$two.quo",
"one'two$.quo",
];
static AND_EXTRA_FILES: &[&str] = &[
"a.foo",
"one/b.foo",
@ -2527,6 +2535,20 @@ fn test_strip_cwd_prefix() {
);
}
#[test]
fn test_quoting() {
let te = TestEnv::new(DEFAULT_DIRS, AND_QUOTE_FILES);
te.assert_output(
&["--quote", ".quo"],
"'one two.quo'
\"one'two.quo\"
\"one'two\\$.quo\"
'one\"two.quo'
'one$two.quo'",
);
}
/// When fd is ran from a non-existent working directory, but an existent
/// directory is passed in the arguments, it should still run fine
#[test]