summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2016-09-05 21:36:19 -0400
committerAndrew Gallant <jamslam@gmail.com>2016-09-05 21:36:19 -0400
commita4d8db16f75f220f658e017afa1ad683e19a1423 (patch)
tree75cb8a9d82004333fc716ce1b75b44858911621a /src
parent3bb387abdd3f6c9a3d16f37fc8abf004eb5bbb35 (diff)
Fix glob tests.0.0.7
When matching directly with a regex, we need to make sure the path is normalized first.
Diffstat (limited to 'src')
-rw-r--r--src/glob.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/glob.rs b/src/glob.rs
index faec94e7..bd7d2471 100644
--- a/src/glob.rs
+++ b/src/glob.rs
@@ -414,6 +414,8 @@ impl<'a> Parser<'a> {
#[cfg(test)]
mod tests {
+ use std::path::Path;
+
use regex::bytes::Regex;
use super::{Error, Pattern, MatchOptions, SetBuilder, Token};
@@ -461,8 +463,9 @@ mod tests {
#[test]
fn $name() {
let pat = Pattern::new($pat).unwrap();
+ let path = &Path::new($path).to_str().unwrap();
let re = Regex::new(&pat.to_regex_with(&$options)).unwrap();
- assert!(re.is_match($path.as_bytes()));
+ assert!(re.is_match(path.as_bytes()));
}
};
}
@@ -475,8 +478,9 @@ mod tests {
#[test]
fn $name() {
let pat = Pattern::new($pat).unwrap();
+ let path = &Path::new($path).to_str().unwrap();
let re = Regex::new(&pat.to_regex_with(&$options)).unwrap();
- assert!(!re.is_match($path.as_bytes()));
+ assert!(!re.is_match(path.as_bytes()));
}
};
}