Skip to content

Commit bb88a1f

Browse files
committed
cross-platform separator testing
Fixes #40
1 parent 273342a commit bb88a1f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/lib.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,9 @@ impl Pattern {
476476
// invalid matches are treated literally
477477
let is_valid =
478478
// is the beginning of the pattern or begins with '/'
479-
if i == 2 || chars[i - count - 1] == '/' {
479+
if i == 2 || path::is_separator(chars[i - count - 1]) {
480480
// it ends in a '/'
481-
if i < chars.len() && chars[i] == '/' {
481+
if i < chars.len() && path::is_separator(chars[i]) {
482482
i += 1;
483483
true
484484
// or the pattern ends here
@@ -1242,4 +1242,10 @@ mod test {
12421242
// tests that / and \ are considered equivalent on windows
12431243
assert!(Pattern::new("a/b").unwrap().matches_path(&Path::new("a/b")));
12441244
}
1245+
1246+
#[test]
1247+
fn test_path_join() {
1248+
let pattern = Path::new("one").join(&Path::new("**/*.rs"));
1249+
assert!(Pattern::new(pattern.to_str().unwrap()).is_ok());
1250+
}
12451251
}

0 commit comments

Comments
 (0)