mirror of
https://framagit.org/ppom/reaction
synced 2026-03-14 20:55:47 +01:00
test Filter::regex conformity after setup
This commit is contained in:
parent
441d981a20
commit
eaf40cb579
2 changed files with 17 additions and 1 deletions
1
TODO
1
TODO
|
|
@ -2,7 +2,6 @@ Test what happens when a Filter's pattern Set changes (I think it's shitty)
|
|||
|
||||
test migration
|
||||
stream: test regex ending with $
|
||||
test Filter::regex conformity after setup
|
||||
|
||||
should an ipv6-mapped ipv4 match a pattern of type ipv6?
|
||||
should it be normalized as ipv4 then?
|
||||
|
|
|
|||
|
|
@ -539,6 +539,7 @@ pub mod tests {
|
|||
.unwrap()
|
||||
.to_string()
|
||||
);
|
||||
assert_eq!(&filter.regex[0].to_string(), "insert (?P<name>[abc]) here$");
|
||||
assert_eq!(filter.patterns.len(), 1);
|
||||
let stored_pattern = filter.patterns.first().unwrap();
|
||||
assert_eq!(stored_pattern.regex, pattern.regex);
|
||||
|
|
@ -564,6 +565,10 @@ pub mod tests {
|
|||
.unwrap()
|
||||
.to_string()
|
||||
);
|
||||
assert_eq!(
|
||||
&filter.compiled_regex[0].to_string(),
|
||||
"insert (?P<name>[abc]) here and (?P<boubou>(?:bou){1,3}) there"
|
||||
);
|
||||
assert_eq!(filter.patterns.len(), 2);
|
||||
let stored_pattern = filter.patterns.first().unwrap();
|
||||
assert_eq!(stored_pattern.regex, boubou.regex);
|
||||
|
|
@ -582,12 +587,20 @@ pub mod tests {
|
|||
.unwrap()
|
||||
.to_string()
|
||||
);
|
||||
assert_eq!(
|
||||
&filter.compiled_regex[0].to_string(),
|
||||
"insert (?P<name>[abc]) here"
|
||||
);
|
||||
assert_eq!(
|
||||
filter.compiled_regex[1].to_string(),
|
||||
Regex::new("also add (?P<name>[abc]) there")
|
||||
.unwrap()
|
||||
.to_string()
|
||||
);
|
||||
assert_eq!(
|
||||
&filter.compiled_regex[1].to_string(),
|
||||
"also add (?P<name>[abc]) there"
|
||||
);
|
||||
assert_eq!(filter.patterns.len(), 1);
|
||||
let stored_pattern = filter.patterns.first().unwrap();
|
||||
assert_eq!(stored_pattern.regex, pattern.regex);
|
||||
|
|
@ -614,6 +627,10 @@ pub mod tests {
|
|||
.unwrap()
|
||||
.to_string()
|
||||
);
|
||||
assert_eq!(
|
||||
&filter.compiled_regex[1].to_string(),
|
||||
"also add (?P<boubou>(?:bou){1,3}) here and (?P<name>[abc]) there"
|
||||
);
|
||||
assert_eq!(filter.patterns.len(), 2);
|
||||
let stored_pattern = filter.patterns.first().unwrap();
|
||||
assert_eq!(stored_pattern.regex, boubou.regex);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue