summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-11-18 08:00:29 +0330
committerAndreas Kling <kling@serenityos.org>2021-11-18 09:09:22 +0100
commit387df06385f1675a489ed2663888f32f26bf55fc (patch)
tree20ad1572bac20e7bc59b1c05888274f32a3650b6 /Tests
parentf10036b7c5c4cf4a9b7d032f1b6569c887cb6ccb (diff)
downloadserenity-387df06385f1675a489ed2663888f32f26bf55fc.zip
LibRegex: Avoid rewriting `a+` as `a*` as part of atomic rewriting
The initial `ForkStay` is only needed if the looping block has a following block, if there's no following block or the following block does not attempt to match anything, we should not insert the ForkStay, otherwise we would be rewriting `a+` as `a*` by allowing the 'end' to be executed. Fixes #10952.
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 6a8ccf956e..45cb422496 100644
--- a/Tests/LibRegex/Regex.cpp
+++ b/Tests/LibRegex/Regex.cpp
@@ -895,6 +895,7 @@ TEST_CASE(optimizer_atomic_groups)
// Fork -> ForkReplace
Tuple { "a*b"sv, "aaaaa"sv, false },
Tuple { "a+b"sv, "aaaaa"sv, false },
+ Tuple { "\\\\(\\d+)"sv, "\\\\"sv, false }, // Rewrite bug turning a+ to a*, see #10952.
// Alternative fuse
Tuple { "(abcfoo|abcbar|abcbaz).*x"sv, "abcbarx"sv, true },
Tuple { "(a|a)"sv, "a"sv, true },