diff options
author | Roman Proskuryakov <humbug@deeptown.org> | 2017-03-28 21:14:32 +0300 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2017-04-09 08:47:35 -0400 |
commit | 90a11dec5e5765af560d343e879869a60363ef54 (patch) | |
tree | 150d2e7b22d10d3e35e8f96d5dacebbdf215c46f /tests | |
parent | 9456d95e8f8f170593a68675ca27ee7010ed045a (diff) |
Add `-o/--only-matching` flag.
Currently, the `--only-matching` flag conflicts with the `--replace`
flag. In the future, this restriction may be relaxed.
Fixes #34
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tests.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/tests.rs b/tests/tests.rs index 9457f452..578dbcba 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -1166,6 +1166,32 @@ be, to a very large extent, the result of luck. Sherlock Holmes assert_eq!(lines, expected); }); +// See: https://github.com/BurntSushi/ripgrep/issues/34 +sherlock!(feature_34_only_matching, "Sherlock", ".", +|wd: WorkDir, mut cmd: Command| { + cmd.arg("--only-matching"); + + let lines: String = wd.stdout(&mut cmd); + let expected = "\ +sherlock:Sherlock +sherlock:Sherlock +"; + assert_eq!(lines, expected); +}); + +// See: https://github.com/BurntSushi/ripgrep/issues/34 +sherlock!(feature_34_only_matching_line_column, "Sherlock", ".", +|wd: WorkDir, mut cmd: Command| { + cmd.arg("--only-matching").arg("--column").arg("--line-number"); + + let lines: String = wd.stdout(&mut cmd); + let expected = "\ +sherlock:1:57:Sherlock +sherlock:3:49:Sherlock +"; + assert_eq!(lines, expected); +}); + // See: https://github.com/BurntSushi/ripgrep/issues/45 sherlock!(feature_45_relative_cwd, "test", ".", |wd: WorkDir, mut cmd: Command| { |