From 9bf0306725d3e36b26860a8d3091affb3dac01f1 Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Wed, 23 Aug 2023 15:54:36 -0700 Subject: [PATCH] Add unit tests for `--quote` --- tests/tests.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/tests.rs b/tests/tests.rs index 5330f40..b1e8f83 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -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]