diff options
author | Andrew Gallant <jamslam@gmail.com> | 2016-09-26 19:57:23 -0400 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2016-09-26 19:57:23 -0400 |
commit | 3e78fce3a3ca226dde4e332a30bf24fad03f8f35 (patch) | |
tree | 04a927a7a706238b10158ef8dae0fe455eb54f58 /tests | |
parent | 7a3fd1f23fe7a4d679fb1fb7d13884a653e5d4f5 (diff) |
Don't print empty lines in single threaded mode.
Fixes #99.
Diffstat (limited to 'tests')
-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"); |