diff options
author | Andrew Gallant <jamslam@gmail.com> | 2019-01-26 16:00:43 -0500 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2019-01-26 16:01:52 -0500 |
commit | 0df71240ff19fe8fa278b64d8776725f0253bcf9 (patch) | |
tree | 2e10221efb7c2e8b17808f46af78e52a604eb1b9 /tests | |
parent | f3164f2615ce18d3ea7b5ce122dfe2a381d1b3f4 (diff) |
search: fix -F and -f interaction bug
This fixes what appears to be a pretty egregious regression where the
`-F/--fixed-strings` flag wasn't be applied to patterns supplied via
the `-f/--file` flag. The same bug existed for the `-x/--line-regexp`
flag as well, which we fix here.
Fixes #1176
Diffstat (limited to 'tests')
-rw-r--r-- | tests/regression.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/regression.rs b/tests/regression.rs index 15a3bb46..98e5b17a 100644 --- a/tests/regression.rs +++ b/tests/regression.rs @@ -672,3 +672,25 @@ rgtest!(r1174, |dir: Dir, mut cmd: TestCommand| { dir.create("a/foo", "test"); cmd.arg("test").assert_err(); }); + +// See: https://github.com/BurntSushi/ripgrep/issues/1176 +rgtest!(r1176_literal_file, |dir: Dir, mut cmd: TestCommand| { + dir.create("patterns", "foo(bar\n"); + dir.create("test", "foo(bar"); + + eqnice!( + "foo(bar\n", + cmd.arg("-F").arg("-f").arg("patterns").arg("test").stdout() + ); +}); + +// See: https://github.com/BurntSushi/ripgrep/issues/1176 +rgtest!(r1176_line_regex, |dir: Dir, mut cmd: TestCommand| { + dir.create("patterns", "foo\n"); + dir.create("test", "foobar\nfoo\nbarfoo\n"); + + eqnice!( + "foo\n", + cmd.arg("-x").arg("-f").arg("patterns").arg("test").stdout() + ); +}); |