Compare commits

..

2 Commits
0.0.6 ... 0.0.8

Author SHA1 Message Date
Andrew Gallant
ee7f300ae2 windows debug, take 1 2016-09-05 21:46:11 -04:00
Andrew Gallant
a4d8db16f7 Fix glob tests.
When matching directly with a regex, we need to make sure the path is
normalized first.
2016-09-05 21:36:19 -04:00
2 changed files with 12 additions and 4 deletions

View File

@@ -32,8 +32,8 @@ build: false
# Equivalent to Travis' `script` phase
# TODO modify this phase as you see fit
test_script:
- cargo build --verbose
- cargo test
# - cargo build --verbose
- cargo test matchslash2 -- --nocapture
before_deploy:
# Generate artifacts for release

View File

@@ -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,12 @@ 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()));
println!("PATTERN: {}", $pat);
println!("REGEX: {:?}", re);
println!("PATH: {}", path);
assert!(!re.is_match(path.as_bytes()));
}
};
}
@@ -638,6 +645,7 @@ mod tests {
matches!(matchslash1, "abc/def", "abc/def", SLASHLIT);
nmatches!(matchslash2, "abc?def", "abc/def", SLASHLIT);
nmatches!(matchslash2_win, "abc?def", "abc\\def", SLASHLIT);
nmatches!(matchslash3, "abc*def", "abc/def", SLASHLIT);
matches!(matchslash4, "abc[/]def", "abc/def", SLASHLIT); // differs