Skip to content

Commit a4d8db1

Browse files
committed
Fix glob tests.
When matching directly with a regex, we need to make sure the path is normalized first.
1 parent 3bb387a commit a4d8db1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/glob.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,8 @@ impl<'a> Parser<'a> {
414414

415415
#[cfg(test)]
416416
mod tests {
417+
use std::path::Path;
418+
417419
use regex::bytes::Regex;
418420

419421
use super::{Error, Pattern, MatchOptions, SetBuilder, Token};
@@ -461,8 +463,9 @@ mod tests {
461463
#[test]
462464
fn $name() {
463465
let pat = Pattern::new($pat).unwrap();
466+
let path = &Path::new($path).to_str().unwrap();
464467
let re = Regex::new(&pat.to_regex_with(&$options)).unwrap();
465-
assert!(re.is_match($path.as_bytes()));
468+
assert!(re.is_match(path.as_bytes()));
466469
}
467470
};
468471
}
@@ -475,8 +478,9 @@ mod tests {
475478
#[test]
476479
fn $name() {
477480
let pat = Pattern::new($pat).unwrap();
481+
let path = &Path::new($path).to_str().unwrap();
478482
let re = Regex::new(&pat.to_regex_with(&$options)).unwrap();
479-
assert!(!re.is_match($path.as_bytes()));
483+
assert!(!re.is_match(path.as_bytes()));
480484
}
481485
};
482486
}

0 commit comments

Comments
 (0)