mirror of
https://github.com/TECHNOFAB11/tmux-copyrat.git
synced 2025-12-12 08:00:08 +01:00
refactor: kebab-style regex pattern names
This commit is contained in:
parent
0f66b6fbd9
commit
c57e78bb66
2 changed files with 11 additions and 6 deletions
|
|
@ -401,9 +401,9 @@ mod tests {
|
|||
let results = Model::new(buffer, &alphabet, &named_pat, &custom, false).matches(false);
|
||||
|
||||
assert_eq!(results.len(), 2);
|
||||
assert_eq!(results.get(0).unwrap().pattern, "markdown_url");
|
||||
assert_eq!(results.get(0).unwrap().pattern, "markdown-url");
|
||||
assert_eq!(results.get(0).unwrap().text, "https://github.io?foo=bar");
|
||||
assert_eq!(results.get(1).unwrap().pattern, "markdown_url");
|
||||
assert_eq!(results.get(1).unwrap().pattern, "markdown-url");
|
||||
assert_eq!(results.get(1).unwrap().text, "http://cdn.com/img.jpg");
|
||||
}
|
||||
|
||||
|
|
@ -460,8 +460,11 @@ mod tests {
|
|||
let results = Model::new(buffer, &alphabet, &named_pat, &custom, false).matches(false);
|
||||
|
||||
assert_eq!(results.len(), 3);
|
||||
assert_eq!(results.get(0).unwrap().pattern, "mem-address");
|
||||
assert_eq!(results.get(0).unwrap().text, "0xfd70b5695");
|
||||
assert_eq!(results.get(1).unwrap().pattern, "mem-address");
|
||||
assert_eq!(results.get(1).unwrap().text, "0x5246ddf");
|
||||
assert_eq!(results.get(2).unwrap().pattern, "mem-address");
|
||||
assert_eq!(results.get(2).unwrap().text, "0x973113");
|
||||
}
|
||||
|
||||
|
|
@ -515,6 +518,7 @@ mod tests {
|
|||
let results = Model::new(buffer, &alphabet, &named_pat, &custom, false).matches(false);
|
||||
|
||||
assert_eq!(results.len(), 1);
|
||||
assert_eq!(results.get(0).unwrap().pattern, "diff-a");
|
||||
assert_eq!(results.get(0).unwrap().text, "src/main.rs");
|
||||
}
|
||||
|
||||
|
|
@ -527,6 +531,7 @@ mod tests {
|
|||
let results = Model::new(buffer, &alphabet, &named_pat, &custom, false).matches(false);
|
||||
|
||||
assert_eq!(results.len(), 1);
|
||||
assert_eq!(results.get(0).unwrap().pattern, "diff-b");
|
||||
assert_eq!(results.get(0).unwrap().text, "src/main.rs");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ pub const EXCLUDE_PATTERNS: [(&'static str, &'static str); 1] =
|
|||
[("ansi_colors", r"[[:cntrl:]]\[([0-9]{1,2};)?([0-9]{1,2})?m")];
|
||||
|
||||
pub const PATTERNS: [(&'static str, &'static str); 15] = [
|
||||
("markdown_url", r"\[[^]]*\]\(([^)]+)\)"),
|
||||
("markdown-url", r"\[[^]]*\]\(([^)]+)\)"),
|
||||
(
|
||||
"url",
|
||||
r"((https?://|git@|git://|ssh://|ftp://|file:///)[^ \(\)\[\]\{\}]+)",
|
||||
),
|
||||
("email", r"\b[A-z0-9._%+-]+@[A-z0-9.-]+\.[A-z]{2,}\b"),
|
||||
("diff_a", r"--- a/([^ ]+)"),
|
||||
("diff_b", r"\+\+\+ b/([^ ]+)"),
|
||||
("diff-a", r"--- a/([^ ]+)"),
|
||||
("diff-b", r"\+\+\+ b/([^ ]+)"),
|
||||
("docker", r"sha256:([0-9a-f]{64})"),
|
||||
("path", r"(([.\w\-@~]+)?(/[.\w\-@]+)+)"),
|
||||
("hexcolor", r"#[0-9a-fA-F]{6}"),
|
||||
|
|
@ -23,7 +23,7 @@ pub const PATTERNS: [(&'static str, &'static str); 15] = [
|
|||
("sha", r"[0-9a-f]{7,40}"),
|
||||
("ip", r"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"),
|
||||
("ipv6", r"[A-f0-9:]+:+[A-f0-9:]+[%\w\d]+"),
|
||||
("address", r"0x[0-9a-fA-F]+"),
|
||||
("mem-address", r"0x[0-9a-fA-F]+"),
|
||||
("number", r"[0-9]{4,}"),
|
||||
];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue