Match @ in paths

This commit is contained in:
Ferran Basora 2019-10-03 16:12:38 +00:00
parent fcb6c60151
commit 2ac8bc25ca
2 changed files with 8 additions and 5 deletions

View File

@ -20,6 +20,8 @@ ipsum [fcsonline](https://github.com/fcsonline) lorem
path: /var/log/nginx.log
path: ./folder/.neomake@04fd.log
10.3.23.42 lorem 123.2.3.4 lorem 230.23.33.34
10.3.23.42 lorem 123.2.3.4 lorem 230.23.33.34
10.3.23.42 lorem 123.2.3.4 lorem 230.23.33.34

View File

@ -13,7 +13,7 @@ const PATTERNS: [(&'static str, &'static str); 12] = [
),
("diff_a", r"--- a/([^ ]+)"),
("diff_b", r"\+\+\+ b/([^ ]+)"),
("path", r"(([.\w-]+)?(/[.\w-]+)+)"),
("path", r"(([.\w\-@]+)?(/[.\w\-@]+)+)"),
("color", r"#[0-9a-fA-F]{6}"),
(
"uid",
@ -210,13 +210,14 @@ mod tests {
#[test]
fn match_bash() {
let lines = split("path: /var/log/nginx.log\npath: test/log/nginx.log:32");
let lines = split("path: /var/log/nginx.log\npath: test/log/nginx-2.log:32folder/.nginx@4df2.log");
let custom = [].to_vec();
let results = State::new(&lines, "abcd", &custom).matches(false, false);
assert_eq!(results.len(), 2);
assert_eq!(results.first().unwrap().text, "/var/log/nginx.log");
assert_eq!(results.last().unwrap().text, "test/log/nginx.log");
assert_eq!(results.len(), 3);
assert_eq!(results.get(0).unwrap().text, "/var/log/nginx.log");
assert_eq!(results.get(1).unwrap().text, "test/log/nginx-2.log");
assert_eq!(results.get(2).unwrap().text, "folder/.nginx@4df2.log");
}
#[test]