Test negation in tagged parser
This commit is contained in:
parent
debded9c0e
commit
d38a78631f
|
@ -14,6 +14,22 @@ fn empty_filter() {
|
|||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn only_bang() {
|
||||
assert!(matches!(
|
||||
Filter::from_str("!"),
|
||||
Err(TaggedFiltererError::Parse { .. })
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_op() {
|
||||
assert!(matches!(
|
||||
Filter::from_str("foobar"),
|
||||
Err(TaggedFiltererError::Parse { .. })
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn path_auto_op() {
|
||||
assert_eq!(
|
||||
|
@ -181,3 +197,17 @@ fn quoted_double() {
|
|||
}
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn negate() {
|
||||
assert_eq!(
|
||||
filter("!path~=^f[om]+$"),
|
||||
Filter {
|
||||
in_path: None,
|
||||
on: Matcher::Path,
|
||||
op: Op::Regex,
|
||||
pat: Pattern::Regex(Regex::new("^f[om]+$").unwrap()),
|
||||
negate: true,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue