diff options
author | Andrew Gallant <jamslam@gmail.com> | 2016-11-06 12:07:47 -0500 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2016-11-06 12:07:47 -0500 |
commit | 0222e024fef6c52fc1cd01b6c7ec01ab38031bce (patch) | |
tree | f7f09e1a44d48a7b7e92c589317e1ca3c5fa0049 /tests | |
parent | 5bd0edbbe10364d085ff0d314b2513e0e9fbf162 (diff) |
Fixes a bug with --smart-case.
This was a subtle bug, but the big picture was that the smart case
information wasn't being carried through to the literal extraction in
some cases. When this happened, it was possible to get back an incomplete
set of literals, which would therefore miss some valid matches.
The fix to this is to actually parse the regex and determine whether
smart case applies before doing anything else. It's a little extra work,
but parsing is pretty fast.
Fixes #199
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 48fb8185..bf6f471d 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -874,6 +874,15 @@ clean!(regression_184, "test", ".", |wd: WorkDir, mut cmd: Command| { assert_eq!(lines, "baz:test\n"); }); +// See: https://github.com/BurntSushi/ripgrep/issues/199 +clean!(regression_199, r"\btest\b", ".", |wd: WorkDir, mut cmd: Command| { + wd.create("foo", "tEsT"); + cmd.arg("--smart-case"); + + let lines: String = wd.stdout(&mut cmd); + assert_eq!(lines, "foo:tEsT\n"); +}); + // See: https://github.com/BurntSushi/ripgrep/issues/206 clean!(regression_206, "test", ".", |wd: WorkDir, mut cmd: Command| { wd.create_dir("foo"); |