diff options
author | Andrew Gallant <jamslam@gmail.com> | 2016-11-06 13:09:53 -0500 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2016-11-06 13:09:53 -0500 |
commit | 58aca2efb24801b43870acac5b40c59fbc9ef350 (patch) | |
tree | fbb20a095b7cfad4d9c2baef86a8073097ec0299 /tests | |
parent | 351eddc17e3f7164978c2f001ff9b8e3bc328e33 (diff) |
Add -m/--max-count flag.
This flag limits the number of matches printed *per file*.
Closes #159
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tests.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/tests.rs b/tests/tests.rs index bf6f471d..59cefb59 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -1071,6 +1071,21 @@ clean!(feature_109_case_sensitive_part2, "test", ".", wd.assert_err(&mut cmd); }); +// See: https://github.com/BurntSushi/ripgrep/issues/159 +clean!(feature_159_works, "test", ".", |wd: WorkDir, mut cmd: Command| { + wd.create("foo", "test\ntest"); + cmd.arg("-m1"); + let lines: String = wd.stdout(&mut cmd); + assert_eq!(lines, "foo:test\n"); +}); + +// See: https://github.com/BurntSushi/ripgrep/issues/159 +clean!(feature_159_zero_max, "test", ".", |wd: WorkDir, mut cmd: Command| { + wd.create("foo", "test\ntest"); + cmd.arg("-m0"); + wd.assert_err(&mut cmd); +}); + #[test] fn binary_nosearch() { let wd = WorkDir::new("binary_nosearch"); |