summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEvan.Mattiza <emattiza@gmail.com>2017-06-14 22:07:55 -0500
committerAndrew Gallant <jamslam@gmail.com>2017-06-15 06:55:55 -0400
commit06393f888c664d0fe2a31422a05b60f6d1bd0b6a (patch)
treec50a882f78ffe2f34486572414177996ab65304e /tests
parente0989ef13bf6be0659fbb8bac3975522b155cbc1 (diff)
fix word boundary w/ capture group
fixes BurntSushi/ripgrep#506. Word boundary search as arg had unexpected behavior. added capture group to regex to encapsulate 'or' option search and prevent expansion and partial boundary finds. Signed-off-by: Evan.Mattiza <emattiza@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/tests.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/tests.rs b/tests/tests.rs
index d9c843ad..95fecfd4 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -1690,6 +1690,23 @@ fn regression_483_non_matching_exit_code() {
wd.assert_err(&mut cmd);
}
+// See: https://github.com/BurntSushi/ripgrep/issues/506
+#[test]
+fn regression_506_word_boundaries_not_parenthesized() {
+ let wd = WorkDir::new("regression_506_word_boundaries_not_parenthesized");
+ let path = "wb.txt";
+ wd.create(path, "min minimum amin\n\
+ max maximum amax");
+
+ let mut cmd = wd.command();
+ cmd.arg("-w").arg("min|max").arg(path).arg("--only-matching");
+ let lines: String = wd.stdout(&mut cmd);
+
+ let expected = "min\nmax\n";
+
+ assert_eq!(lines, expected);
+
+}
#[test]
fn type_list() {