summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEdoardo Pirovano <edoardo.pirovano@gmail.com>2021-07-07 17:50:23 +0100
committerAndrew Gallant <jamslam@gmail.com>2023-07-08 18:52:42 -0400
commit6d95c130d5fb56a8641092a4808f33640bfa935c (patch)
tree6948223cf4f179cfcdc8a465dad2ed7076e02c9f /tests
parent4782ebd5e0773465ba2c32a328250253c2b55779 (diff)
cli: add --stop-on-nonmatch flag
This causes ripgrep to stop searching an individual file after it has found a non-matching line. But this only occurs after it has found a matching line. Fixes #1790, Closes #1930
Diffstat (limited to 'tests')
-rw-r--r--tests/feature.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/feature.rs b/tests/feature.rs
index 8283a1bb..6d4d1947 100644
--- a/tests/feature.rs
+++ b/tests/feature.rs
@@ -992,3 +992,10 @@ rgtest!(no_unicode, |dir: Dir, mut cmd: TestCommand| {
dir.create("test", "δ");
cmd.arg("-i").arg("--no-unicode").arg("Δ").assert_err();
});
+
+// See: https://github.com/BurntSushi/ripgrep/issues/1790
+rgtest!(stop_on_nonmatch, |dir: Dir, mut cmd: TestCommand| {
+ dir.create("test", "line1\nline2\nline3\nline4\nline5");
+ cmd.args(&["--stop-on-nonmatch", "[235]"]);
+ eqnice!("test:line2\ntest:line3\n", cmd.stdout());
+});