summaryrefslogtreecommitdiff
path: root/Tests/LibRegex/Regex.cpp
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2021-08-11 17:52:57 -0400
committerLinus Groh <mail@linusgroh.de>2021-08-15 11:43:45 +0100
commitc3e1f1f687a3f2190cb666d73884b7884eeb5ad0 (patch)
tree48d88fbf72ee66a010885dd247da435db1ceb168 /Tests/LibRegex/Regex.cpp
parent6a485f612fbda354c8c67e9ccc3c119356687354 (diff)
downloadserenity-c3e1f1f687a3f2190cb666d73884b7884eeb5ad0.zip
LibRegex: Use correct source characters for Unicode identity escapes
Diffstat (limited to 'Tests/LibRegex/Regex.cpp')
-rw-r--r--Tests/LibRegex/Regex.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Tests/LibRegex/Regex.cpp b/Tests/LibRegex/Regex.cpp
index 2e8cce5c30..e77a90356e 100644
--- a/Tests/LibRegex/Regex.cpp
+++ b/Tests/LibRegex/Regex.cpp
@@ -557,6 +557,8 @@ TEST_CASE(ECMA262_parse)
{ "[\\0]"sv, regex::Error::NoError, combine_flags(ECMAScriptFlags::Unicode, ECMAScriptFlags::BrowserExtended) },
{ "[\\00]"sv, regex::Error::NoError, ECMAScriptFlags::BrowserExtended },
{ "[\\00]"sv, regex::Error::InvalidPattern, combine_flags(ECMAScriptFlags::Unicode, ECMAScriptFlags::BrowserExtended) },
+ { "\\^\\$\\\\\\.\\*\\+\\?\\(\\)\\[\\]\\{\\}\\|\\/"sv, regex::Error::NoError, ECMAScriptFlags::Unicode },
+ { "[\\^\\$\\\\\\.\\*\\+\\?\\(\\)\\[\\]\\{\\}\\|\\/]"sv, regex::Error::NoError, ECMAScriptFlags::Unicode },
};
for (auto& test : tests) {
@@ -605,6 +607,8 @@ TEST_CASE(ECMA262_match)
{ "((...)X)+"sv, "fooXbarXbazX"sv, true },
{ "(?:)"sv, ""sv, true },
{ "\\^"sv, "^"sv },
+ { "\\^\\$\\\\\\.\\*\\+\\?\\(\\)\\[\\]\\{\\}\\|\\/"sv, "^$\\.*+?()[]{}|/"sv, true, ECMAScriptFlags::Unicode },
+ { "[\\^\\$\\\\\\.\\*\\+\\?\\(\\)\\[\\]\\{\\}\\|\\/]{15}"sv, "^$\\.*+?()[]{}|/"sv, true, ECMAScriptFlags::Unicode },
// ECMA262, B.1.4. Regular Expression Pattern extensions for browsers
{ "{"sv, "{"sv, true, ECMAScriptFlags::BrowserExtended },
{ "\\5"sv, "\5"sv, true, ECMAScriptFlags::BrowserExtended },