summaryrefslogtreecommitdiff
path: root/Tests/LibRegex/Regex.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/LibRegex/Regex.cpp')
-rw-r--r--Tests/LibRegex/Regex.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/Tests/LibRegex/Regex.cpp b/Tests/LibRegex/Regex.cpp
index 452d97fed5..366b414819 100644
--- a/Tests/LibRegex/Regex.cpp
+++ b/Tests/LibRegex/Regex.cpp
@@ -1089,6 +1089,18 @@ TEST_CASE(single_match_flag)
}
}
+TEST_CASE(empty_string_wildcard_match)
+{
+ {
+ // Ensure that the wildcard ".*" matches the empty string exactly once
+ Regex<ECMA262> re(".*"sv, ECMAScriptFlags::Global);
+ auto result = re.match(""sv);
+ EXPECT_EQ(result.success, true);
+ EXPECT_EQ(result.matches.size(), 1u);
+ EXPECT_EQ(result.matches.first().view.to_deprecated_string(), ""sv);
+ }
+}
+
TEST_CASE(inversion_state_in_char_class)
{
{