diff options
Diffstat (limited to 'tests/tests.rs')
-rw-r--r-- | tests/tests.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/tests.rs b/tests/tests.rs index d6767065..11513aa2 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -54,6 +54,13 @@ fn path(unix: &str) -> String { } } +fn sort_lines(lines: &str) -> String { + let mut lines: Vec<String> = + lines.trim().lines().map(|s| s.to_owned()).collect(); + lines.sort(); + format!("{}\n", lines.join("\n")) +} + sherlock!(single_file, |wd: WorkDir, mut cmd| { let lines: String = wd.stdout(&mut cmd); let expected = "\ @@ -716,6 +723,18 @@ clean!(regression_93, r"(\d{1,3}\.){3}\d{1,3}", ".", assert_eq!(lines, "foo:192.168.1.1\n"); }); +// See: https://github.com/BurntSushi/ripgrep/issues/99 +clean!(regression_99, "test", ".", +|wd: WorkDir, mut cmd: Command| { + wd.create("foo1", "test"); + wd.create("foo2", "zzz"); + wd.create("bar", "test"); + cmd.arg("-j1").arg("--heading"); + + let lines: String = wd.stdout(&mut cmd); + assert_eq!(sort_lines(&lines), sort_lines("bar\ntest\n\nfoo1\ntest\n")); +}); + // See: https://github.com/BurntSushi/ripgrep/issues/105 clean!(regression_105_part1, "test", ".", |wd: WorkDir, mut cmd: Command| { wd.create("foo", "zztest"); |