summaryrefslogtreecommitdiffstats
path: root/globset
diff options
context:
space:
mode:
authorBehnam Esfahbod <behnam@zwnj.org>2018-02-04 18:07:55 -0800
committerAndrew Gallant <jamslam@gmail.com>2018-02-06 17:42:22 -0500
commit706323ad8f2600db7d46482a7d95972b1416c0eb (patch)
tree00f7f71907c5fbe8c58983078f4533b7062db076 /globset
parent8460d7fe3d82c2a074abc89cb08e4645b444cef9 (diff)
globset: add more tests for single-asterisk pattern
This adds a few tests that check for bugs reported here: https://github.com/rust-lang/cargo/issues/4268 The bugs reported in the aforementioned issue are probably caused by not enabling the `literal_separator` option in `GlobBuilder`. Enabling that in the tests under question fixes the issue. Closes #773
Diffstat (limited to 'globset')
-rw-r--r--globset/src/glob.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/globset/src/glob.rs b/globset/src/glob.rs
index ff7b74aa..05467d50 100644
--- a/globset/src/glob.rs
+++ b/globset/src/glob.rs
@@ -1155,6 +1155,7 @@ mod tests {
matches!(matchrec22, ".*/**", ".abc/abc");
matches!(matchrec23, "foo/**", "foo");
matches!(matchrec24, "**/foo/bar", "foo/bar");
+ matches!(matchrec25, "some/*/needle.txt", "some/one/needle.txt");
matches!(matchrange1, "a[0-9]b", "a0b");
matches!(matchrange2, "a[0-9]b", "a9b");
@@ -1243,6 +1244,13 @@ mod tests {
nmatches!(matchnot27, "a[^0-9]b", "a0b");
nmatches!(matchnot28, "a[^0-9]b", "a9b");
nmatches!(matchnot29, "[^-]", "-");
+ nmatches!(matchnot30, "some/*/needle.txt", "some/needle.txt");
+ nmatches!(
+ matchrec31,
+ "some/*/needle.txt", "some/one/two/needle.txt", SLASHLIT);
+ nmatches!(
+ matchrec32,
+ "some/*/needle.txt", "some/one/two/three/needle.txt", SLASHLIT);
macro_rules! extract {
($which:ident, $name:ident, $pat:expr, $expect:expr) => {