LibRegex: Correctly use ClassSetReservedPunctuator in ClassSetCharacter
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run

We had typo'd using ClassSetReservedDoublePunctuator which was
resulting in a parse error for the regex:

([^\\:]+?)

With the 'v' flag set.

Co-Authored-By: Ali Mohammad Pur <mpfard@serenityos.org>
This commit is contained in:
Shannon Booth 2025-07-10 21:10:00 +12:00 committed by Ali Mohammad Pur
commit bd6581fe22
Notes: github-actions[bot] 2025-07-10 09:42:19 +00:00
2 changed files with 23 additions and 1 deletions

View file

@ -753,6 +753,23 @@ TEST_CASE(ECMA262_match)
}
}
TEST_CASE(ECMA262_unicode_parser_error)
{
struct _test {
StringView pattern;
regex::Error error;
};
constexpr _test tests[] {
{ "([^\\:]+?)"sv, regex::Error::InvalidPattern },
};
for (auto test : tests) {
Regex<ECMA262> re(test.pattern, (ECMAScriptFlags)regex::AllFlags::Unicode);
EXPECT_EQ(re.parser_result.error, test.error);
}
}
TEST_CASE(ECMA262_unicode_match)
{
constexpr auto space_and_line_terminator_code_points = Array { 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x0020, 0x00A0, 0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x2028, 0x2029, 0x202F, 0x205F, 0x3000, 0xFEFF };
@ -859,6 +876,7 @@ TEST_CASE(ECMA262_unicode_sets_match)
{ "[[0-9\\w]--x--6]"sv, "9"sv, true },
{ "[\\w&&\\d]"sv, "a"sv, false },
{ "[\\w&&\\d]"sv, "4"sv, true },
{ "([^\\:]+?)"sv, "a"sv, true },
};
for (auto& test : tests) {