use super::*;
#[test]
fn empty_query_matches_everything() {
assert!(matches_query(Path::new("/a/b/c"), ""));
assert!(matches_query(Path::new("/"), ""));
}
#[test]
fn basename_substring_match() {
assert!(matches_query(Path::new("/a/README.md"), "readme"));
assert!(matches_query(Path::new("/a/README.md"), "ead"));
assert!(matches_query(Path::new("/a/README.md"), ".md"));
}
#[test]
fn case_insensitive() {
assert!(matches_query(Path::new("/a/README.md"), "readme"));
assert!(matches_query(Path::new("/a/readme.md"), "readme"));
assert!(matches_query(Path::new("/a/ReAdMe.md"), "readme"));
}
#[test]
fn path_components_dont_match() {
assert!(!matches_query(Path::new("/project/src/main.rs"), "src"));
}
#[test]
fn no_match_returns_false() {
assert!(!matches_query(Path::new("/a/README.md"), "xyz"));
assert!(!matches_query(Path::new("/"), "anything"));
}
#[test]
fn query_longer_than_basename_is_no_match() {
assert!(!matches_query(
Path::new("/a/short.rs"),
"a_much_longer_substring"
));
}