@@ -2135,14 +2135,49 @@ fn test_fixed_strings() {
21352135 // Regex search, parens are treated as group
21362136 te. assert_output ( & [ "download (1)" ] , "" ) ;
21372137
2138- // Literal search, parens are treated as characters
2138+ // Literal search, parens are treated as characters. Case-insensitive by default.
21392139 te. assert_output (
21402140 & [ "--fixed-strings" , "download (1)" ] ,
21412141 "test2/Download (1).tar.gz" ,
21422142 ) ;
21432143
2144- // Combine with --case-sensitive
2144+ // Combine with --case-sensitive (unmatched).
21452145 te. assert_output ( & [ "--fixed-strings" , "--case-sensitive" , "download (1)" ] , "" ) ;
2146+
2147+ // Combine with --case-sensitive (matched).
2148+ te. assert_output (
2149+ & [ "--fixed-strings" , "--case-sensitive" , "Download (1)" ] ,
2150+ "test2/Download (1).tar.gz" ,
2151+ ) ;
2152+ }
2153+
2154+ /// Literal search, non-substring (--exact)
2155+ #[ test]
2156+ fn test_exact_literal_nonsubstring ( ) {
2157+ let dirs = & [ "test1" , "test2" ] ;
2158+ let files = & [ "test1/a.foo" , "test1/a_foo" , "test2/Download (1).tar.gz" ] ;
2159+ let te = TestEnv :: new ( dirs, files) ;
2160+
2161+ // Literal search, dot is treated as character
2162+ te. assert_output ( & [ "--exact" , "a.foo" ] , "test1/a.foo" ) ;
2163+
2164+ // Literal search, parens are treated as characters. Substring should not match.
2165+ te. assert_output ( & [ "--exact" , "download (1)" ] , "" ) ;
2166+
2167+ // Literal search, parens are treated as characters. Case-insensitive by default.
2168+ te. assert_output (
2169+ & [ "--exact" , "download (1).tar.gz" ] ,
2170+ "test2/Download (1).tar.gz" ,
2171+ ) ;
2172+
2173+ // Combine with --case-sensitive, should not match due to case mismatch.
2174+ te. assert_output ( & [ "--exact" , "--case-sensitive" , "download (1).tar.gz" ] , "" ) ;
2175+
2176+ // Combine with --case-sensitive, exact match should match.
2177+ te. assert_output (
2178+ & [ "--exact" , "--case-sensitive" , "Download (1).tar.gz" ] ,
2179+ "test2/Download (1).tar.gz" ,
2180+ ) ;
21462181}
21472182
21482183/// Filenames with invalid UTF-8 sequences
0 commit comments