mirror of
https://github.com/TECHNOFAB11/tmux-copyrat.git
synced 2025-12-13 08:30:07 +01:00
feat: match ISO datetimes
This commit is contained in:
parent
8cc42dbe44
commit
7ce0e95c8c
3 changed files with 35 additions and 3 deletions
|
|
@ -547,6 +547,32 @@ mod tests {
|
|||
assert_eq!(spans.get(0).unwrap().text, "src/main.rs");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn match_datetime() {
|
||||
let buffer = "12 days ago = 2021-03-04T12:23:34 text";
|
||||
let lines = buffer.split('\n').collect::<Vec<_>>();
|
||||
let use_all_patterns = true;
|
||||
let named_pat = vec![];
|
||||
let custom = vec![];
|
||||
let alphabet = Alphabet("abcd".to_string());
|
||||
let reverse = false;
|
||||
let unique_hint = false;
|
||||
let spans = Model::new(
|
||||
&lines,
|
||||
&alphabet,
|
||||
use_all_patterns,
|
||||
&named_pat,
|
||||
&custom,
|
||||
reverse,
|
||||
unique_hint,
|
||||
)
|
||||
.spans;
|
||||
|
||||
assert_eq!(spans.len(), 1);
|
||||
assert_eq!(spans.get(0).unwrap().pattern, "datetime");
|
||||
assert_eq!(spans.get(0).unwrap().text, "2021-03-04T12:23:34");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn priority_between_regexes() {
|
||||
let buffer = "Lorem [link](http://foo.bar) ipsum CUSTOM-52463 lorem ISSUE-123 lorem\nLorem /var/fd70b569/9999.log 52463 lorem\n Lorem 973113 lorem 123e4567-e89b-12d3-a456-426655440000 lorem 8888 lorem\n https://crates.io/23456/fd70b569 lorem";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue