diff options
author | Andrew Gallant <jamslam@gmail.com> | 2017-03-12 15:51:07 -0400 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2017-03-12 15:51:17 -0400 |
commit | 80e91a1f1d725eb8e331f3613a352edb8b13677b (patch) | |
tree | 981ef24eabd2545b82599e16a99b07808972cf4c /tests | |
parent | d570f78144b8fb63d02382630d10d5db174d21ce (diff) |
Fix leading slash bug when used with `!`.
When writing paths like `!/foo` in gitignore files (or when using the
-g/--glob flag), the presence of `!` would prevent the gitignore builder
from noticing the leading slash, which causes absolute path matching to
fail.
Fixes #405
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tests.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/tests.rs b/tests/tests.rs index e21ea42f..d56e4952 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -1045,6 +1045,18 @@ clean!(regression_279, "test", ".", |wd: WorkDir, mut cmd: Command| { assert_eq!(lines, ""); }); +// See: https://github.com/BurntSushi/ripgrep/issues/405 +clean!(regression_405, "test", ".", |wd: WorkDir, mut cmd: Command| { + wd.create_dir("foo/bar"); + wd.create_dir("bar/foo"); + wd.create("foo/bar/file1.txt", "test"); + wd.create("bar/foo/file2.txt", "test"); + cmd.arg("-g").arg("!/foo/**"); + + let lines: String = wd.stdout(&mut cmd); + assert_eq!(lines, "bar/foo/file2.txt:test\n"); +}); + // See: https://github.com/BurntSushi/ripgrep/issues/7 sherlock!(feature_7, "-fpat", "sherlock", |wd: WorkDir, mut cmd: Command| { wd.create("pat", "Sherlock\nHolmes"); |