diff options
author | Andrew Gallant <jamslam@gmail.com> | 2016-09-25 20:10:28 -0400 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2016-09-25 20:10:28 -0400 |
commit | 6a8051b258408343c4cf164acdc4cc2cd7928129 (patch) | |
tree | cb9b49be8c46284c168ea21a6b53e6fc8f7cf411 /tests | |
parent | a13ac3e3d49729403a734c9f3eab2d99a66e21b0 (diff) |
Don't union inner literals of repetitions.
If we do, this results in extracting `foofoofoo` from `(\wfoo){3}`,
which is wrong. This does prevent us from extracting `foofoofoo` from
`foo{3}`, which is unfortunate, but we miss plenty of other stuff too.
Literal extracting needs a good rethink (all the way down into the regex
engine).
Fixes #93
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tests.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/tests.rs b/tests/tests.rs index 85ca1164..a0b01c6a 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -703,6 +703,15 @@ clean!(regression_90, "test", ".", |wd: WorkDir, mut cmd: Command| { assert_eq!(lines, ".foo:test\n"); }); +// See: https://github.com/BurntSushi/ripgrep/issues/93 +clean!(regression_93, r"(\d{1,3}\.){3}\d{1,3}", ".", +|wd: WorkDir, mut cmd: Command| { + wd.create("foo", "192.168.1.1"); + + let lines: String = wd.stdout(&mut cmd); + assert_eq!(lines, "foo:192.168.1.1\n"); +}); + // See: https://github.com/BurntSushi/ripgrep/issues/20 sherlock!(feature_20, "Sherlock", ".", |wd: WorkDir, mut cmd: Command| { cmd.arg("--no-filename"); |