summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-10-29 16:21:13 +0330
committerAndreas Kling <kling@serenityos.org>2021-10-29 15:57:59 +0200
commitac856cb96541f8165bbadbd4530b3d1ee7ed4395 (patch)
tree685922c65ddb9b3df4c8a8fb0733b351896c4009 /Tests
parent7ee409ef98bfee458616b1192cebdb89af65e676 (diff)
downloadserenity-ac856cb96541f8165bbadbd4530b3d1ee7ed4395.zip
LibRegex: Don't ignore empty alternatives in append_alternation()
Doing so would cause patterns like `(a|)` to not match the empty string.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/LibRegex/Regex.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/Tests/LibRegex/Regex.cpp b/Tests/LibRegex/Regex.cpp
index 540c11d4ff..31a22bdddf 100644
--- a/Tests/LibRegex/Regex.cpp
+++ b/Tests/LibRegex/Regex.cpp
@@ -898,6 +898,7 @@ TEST_CASE(optimizer_atomic_groups)
// Alternative fuse
Tuple { "(abcfoo|abcbar|abcbaz).*x"sv, "abcbarx"sv, true },
Tuple { "(a|a)"sv, "a"sv, true },
+ Tuple { "(a|)"sv, ""sv, true }, // Ensure that empty alternatives are not outright removed
// ForkReplace shouldn't be applied where it would change the semantics
Tuple { "(1+)\\1"sv, "11"sv, true },
Tuple { "(1+)1"sv, "11"sv, true },