summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2018-09-24 19:24:33 -0400
committerAndrew Gallant <jamslam@gmail.com>2018-09-25 16:56:04 -0400
commitba503eb6775f0031c684a3bfeeb1c9cb07601dd6 (patch)
treef762c930ce30d8b84651159545fead545484f492 /tests
parentf72c2dfd90f98cfbd678d3d957e3d104237ab15b (diff)
grep-regex: fix inner literal detection
It seems the inner literal detector fails spectacularly in cases of concatenations that involve groups. The issue here is that if the prefix of a group inside a concatenation can match the empty string, then any literals generated to that point in the concatenation need to be cut such that they are never extended. The detector isn't really built to handle this case, so we just act conservative cut literals whenever we see a sub-group. This may make some regexes slower, but the inner literal detector already misses plenty of cases. Literal detection (including in the regex engine) is a key component that needs to be completely rethought at some point. Fixes #1064
Diffstat (limited to 'tests')
-rw-r--r--tests/regression.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/regression.rs b/tests/regression.rs
index f2553d96..abf29bdd 100644
--- a/tests/regression.rs
+++ b/tests/regression.rs
@@ -562,3 +562,9 @@ rgtest!(r900, |dir: Dir, mut cmd: TestCommand| {
cmd.arg("-fpat").arg("sherlock").assert_err();
});
+
+// See: https://github.com/BurntSushi/ripgrep/issues/1064
+rgtest!(r1064, |dir: Dir, mut cmd: TestCommand| {
+ dir.create("input", "abc");
+ eqnice!("input:abc\n", cmd.arg("a(.*c)").stdout());
+});