mirror of
https://github.com/FliegendeWurst/tmux-thumbs.git
synced 2024-11-09 16:00:35 +00:00
Fix path pattern, again
This commit is contained in:
parent
e1f50601e1
commit
b900325319
@ -13,7 +13,7 @@ const PATTERNS: [(&'static str, &'static str); 11] = [
|
|||||||
),
|
),
|
||||||
("diff_a", r"--- a/([^ ]+)"),
|
("diff_a", r"--- a/([^ ]+)"),
|
||||||
("diff_b", r"\+\+\+ b/([^ ]+)"),
|
("diff_b", r"\+\+\+ b/([^ ]+)"),
|
||||||
("path", r"/?[^ :/]+/[^: [[:cntrl:]]]+"),
|
("path", r"(([.\w-]+)?(/[.\w-]+)+)"),
|
||||||
("color", r"#[0-9a-fA-F]{6}"),
|
("color", r"#[0-9a-fA-F]{6}"),
|
||||||
(
|
(
|
||||||
"uid",
|
"uid",
|
||||||
@ -221,11 +221,14 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn match_paths() {
|
fn match_paths() {
|
||||||
let lines =
|
let lines =
|
||||||
split("Lorem /tmp/foo/bar lorem\n Lorem /var/log/bootstrap.log lorem ../log/kern.log lorem");
|
split("Lorem /tmp/foo/bar_lol, lorem\n Lorem /var/log/boot-strap.log lorem ../log/kern.log lorem");
|
||||||
let custom = [].to_vec();
|
let custom = [].to_vec();
|
||||||
let results = State::new(&lines, "abcd", &custom).matches(false, false);
|
let results = State::new(&lines, "abcd", &custom).matches(false, false);
|
||||||
|
|
||||||
assert_eq!(results.len(), 3);
|
assert_eq!(results.len(), 3);
|
||||||
|
assert_eq!(results.get(0).unwrap().text.clone(), "/tmp/foo/bar_lol");
|
||||||
|
assert_eq!(results.get(1).unwrap().text.clone(), "/var/log/boot-strap.log");
|
||||||
|
assert_eq!(results.get(2).unwrap().text.clone(), "../log/kern.log");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
Loading…
Reference in New Issue
Block a user