From eaf40cb57929a39728200709a26569b5154911cd Mon Sep 17 00:00:00 2001 From: ppom Date: Wed, 6 Aug 2025 12:00:00 +0200 Subject: [PATCH] test Filter::regex conformity after setup --- TODO | 1 - src/concepts/filter.rs | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/TODO b/TODO index 4e068e1..baef0f9 100644 --- a/TODO +++ b/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? diff --git a/src/concepts/filter.rs b/src/concepts/filter.rs index e8e7a0b..fef8391 100644 --- a/src/concepts/filter.rs +++ b/src/concepts/filter.rs @@ -539,6 +539,7 @@ pub mod tests { .unwrap() .to_string() ); + assert_eq!(&filter.regex[0].to_string(), "insert (?P[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[abc]) here and (?P(?: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[abc]) here" + ); assert_eq!( filter.compiled_regex[1].to_string(), Regex::new("also add (?P[abc]) there") .unwrap() .to_string() ); + assert_eq!( + &filter.compiled_regex[1].to_string(), + "also add (?P[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(?:bou){1,3}) here and (?P[abc]) there" + ); assert_eq!(filter.patterns.len(), 2); let stored_pattern = filter.patterns.first().unwrap(); assert_eq!(stored_pattern.regex, boubou.regex);