summaryrefslogtreecommitdiff
path: root/Tests/LibRegex
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2022-11-09 21:34:36 +0330
committerAndreas Kling <kling@serenityos.org>2022-11-09 21:28:54 +0100
commit00326a63ed6b07acfe437ccae1253b593463c75b (patch)
tree4d7ad16dc335155a29b599a10a65a676332bdad6 /Tests/LibRegex
parent0ea399d8d691d4446f632f54a22942277edcb5e1 (diff)
downloadserenity-00326a63ed6b07acfe437ccae1253b593463c75b.zip
LibRegex: Don't treat ForkReplace* as new forks
Diffstat (limited to 'Tests/LibRegex')
-rw-r--r--Tests/LibRegex/Regex.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Tests/LibRegex/Regex.cpp b/Tests/LibRegex/Regex.cpp
index abcfa93513..15e972a24d 100644
--- a/Tests/LibRegex/Regex.cpp
+++ b/Tests/LibRegex/Regex.cpp
@@ -1067,6 +1067,12 @@ TEST_CASE(negative_lookahead)
EXPECT_EQ(re.match(":1"sv).success, false);
EXPECT_EQ(re.match(":foobar"sv).success, true);
}
+ {
+ // Correctly count forks with nested groups and optimised loops
+ Regex<ECMA262> re("^((?:[^\\n]|\\n(?! *\\n))+)(?:\\n *)+\\n");
+ EXPECT_EQ(re.match("foo\n\n"sv).success, true);
+ EXPECT_EQ(re.match("foo\n"sv).success, false);
+ }
}
TEST_CASE(single_match_flag)