From 5f11c71210b6b9c7f903ac3f1b755a4af1d7af8f Mon Sep 17 00:00:00 2001 From: David Herberth Date: Mon, 26 Aug 2024 08:47:27 +0200 Subject: [PATCH] test(pattern): Add single alternate group tests (#3942) --- relay-pattern/src/lib.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/relay-pattern/src/lib.rs b/relay-pattern/src/lib.rs index 32ddfbe768..99a9e139f2 100644 --- a/relay-pattern/src/lib.rs +++ b/relay-pattern/src/lib.rs @@ -1060,6 +1060,10 @@ mod tests { assert_pattern!("???????????x???????????", "??______???x?????_?????"); assert_pattern!("???????????x???????????", NOT "?______???x?????_?????"); assert_pattern!("???????????x???????????", NOT "??______???_?????_?????"); + assert_pattern!( + "??????????????????????????????????????????????????", + "?????????????????????????????????????????????????!" + ); // No special slash handling assert_pattern!("?", "/"); @@ -1249,6 +1253,9 @@ mod tests { #[test] fn test_alternates() { + assert_pattern!("{foo}", "foo"); + assert_pattern!("{foo}", NOT "fOo"); + assert_pattern!("{foo}", NOT "bar"); assert_pattern!("{foo,bar}", "foo"); assert_pattern!("{foo,bar}", "bar"); assert_pattern!("{foo,bar}", NOT "Foo"); @@ -1295,11 +1302,15 @@ mod tests { #[test] fn test_alternates_case_insensitive() { + assert_pattern!("{foo}", "foo", i); + assert_pattern!("{foo}", "fOo", i); + assert_pattern!("{foo}", NOT "bar", i); assert_pattern!("{foo,bar}", "foo", i); assert_pattern!("{foo,bar}", "bar", i); assert_pattern!("{foo,bar}", "Foo", i); assert_pattern!("{foo,bar}", "fOo", i); assert_pattern!("{foo,bar}", "BAR", i); + assert_pattern!("{foo,bar}", NOT "bao", i); assert_pattern!("{f[o0-9]o,b[a]r}", "foo", i); assert_pattern!("{f[o0-9]o,b[a]r}", "fOo", i); assert_pattern!("{f[o0-9]o,b[a]r}", "f1o", i);