mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-02-09 14:14:56 +02:00
fix tests
This commit is contained in:
parent
0e46171e3b
commit
8203a80ac7
@ -124,8 +124,10 @@ impl Gitignore {
|
||||
/// Like matched, but takes a path that has already been stripped.
|
||||
pub fn matched_stripped(&self, path: &Path, is_dir: bool) -> Match {
|
||||
thread_local! {
|
||||
static MATCHES: RefCell<Vec<usize>> = RefCell::new(vec![]);
|
||||
}
|
||||
static MATCHES: RefCell<Vec<usize>> = {
|
||||
RefCell::new(vec![])
|
||||
};
|
||||
};
|
||||
MATCHES.with(|matches| {
|
||||
let mut matches = matches.borrow_mut();
|
||||
self.set.matches_into(path, &mut *matches);
|
||||
|
@ -759,9 +759,6 @@ mod tests {
|
||||
let pat = Pattern::new($pat).unwrap();
|
||||
let path = &Path::new($path).to_str().unwrap();
|
||||
let re = Regex::new(&pat.to_regex_with(&$options)).unwrap();
|
||||
// println!("PATTERN: {}", $pat);
|
||||
// println!("REGEX: {:?}", re);
|
||||
// println!("PATH: {}", path);
|
||||
assert!(!re.is_match(path.as_bytes()));
|
||||
}
|
||||
};
|
||||
|
@ -61,11 +61,11 @@ pub fn file_name<'a, P: AsRef<Path> + ?Sized>(
|
||||
let mut last_slash = 0;
|
||||
for (i, &b) in path.iter().enumerate().rev() {
|
||||
if b == b'/' {
|
||||
last_slash = i;
|
||||
last_slash = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Some(OsStr::from_bytes(&path[last_slash + 1..]))
|
||||
Some(OsStr::from_bytes(&path[last_slash..]))
|
||||
}
|
||||
|
||||
/// The final component of the path, if it is a normal file.
|
||||
|
Loading…
x
Reference in New Issue
Block a user