Skip to content
Myr

test: Add --exact test cases, add --fixed-string cases too

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by DeflateAwning · committed by DeflateAwning · parent 82485bf · Browse files · 1 file+37 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+37 added−2 removed

  • tests:+37 added−2 removed

1 file+37 added−2 removed

modified:tests/tests.rs+37 added-2 removed
2133 unmodified lines
21342135 // Regex search, parens are treated as group2136 te.assert_output(&["download (1)"], "");21372138 // Literal search, parens are treated as characters2138 // Literal search, parens are treated as characters. Case-insensitive by default.2139 te.assert_output(2140 &["--fixed-strings", "download (1)"],2141 "test2/Download (1).tar.gz",2142 );21432144 // Combine with --case-sensitive2144 // Combine with --case-sensitive (unmatched).2145 te.assert_output(&["--fixed-strings", "--case-sensitive", "download (1)"], "");21462147 // Combine with --case-sensitive (matched).2148 te.assert_output(2149 &["--fixed-strings", "--case-sensitive", "Download (1)"],2150 "test2/Download (1).tar.gz",2151 );2152}21532154/// Literal search, non-substring (--exact)2155#[test]2156fn 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);21602161 // Literal search, dot is treated as character2162 te.assert_output(&["--exact", "a.foo"], "test1/a.foo");21632164 // Literal search, parens are treated as characters. Substring should not match.2165 te.assert_output(&["--exact", "download (1)"], "");21662167 // 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 );21722173 // Combine with --case-sensitive, should not match due to case mismatch.2174 te.assert_output(&["--exact", "--case-sensitive", "download (1).tar.gz"], "");21752176 // 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 );2181}21822183/// Filenames with invalid UTF-8 sequences2184#[cfg(target_os = "linux")]2185#[test]2186fn test_invalid_utf8() {
609 unmodified lines