From 105098131b8b55a5034fe885d9651d185dabf596 Mon Sep 17 00:00:00 2001 From: aplefull Date: Sun, 17 May 2026 13:27:07 +0200 Subject: [PATCH] Tests+Meta: Reimport WebKit regexp tests This commit updates Meta/import-webkit-regexp-tests.py and re-imports WebKit tests. Removed pcre-test-1 from SKIP_TESTS because we pass it. Removed everything except slow.js from XFAIL_TESTS. We pass everything except slow.js, which still hits the step limit. Moved overflow.js to SKIP_FILES because it tests WebKit's behaviour of rejecting regexps with huge quantifiers. Ladybird, Chrome, and Firefox just clamp them. --- Meta/import-webkit-regexp-tests.py | 19 +++--- .../alternative-length-miscalculation.js | 4 ++ .../Runtime/3rdparty/webkit/assertion.js | 4 ++ .../Runtime/3rdparty/webkit/backreferences.js | 4 ++ .../Runtime/3rdparty/webkit/constructor.js | 4 ++ .../LibJS/Runtime/3rdparty/webkit/dotstar.js | 4 ++ .../Runtime/3rdparty/webkit/early-acid3-86.js | 4 ++ .../3rdparty/webkit/ecma-regex-examples.js | 4 ++ .../3rdparty/webkit/invalid-range-in-class.js | 4 ++ .../Runtime/3rdparty/webkit/lastIndex.js | 4 ++ .../3rdparty/webkit/malformed-escapes.js | 5 +- .../webkit/non-capturing-backtracking.js | 4 ++ .../3rdparty/webkit/non-pattern-characters.js | 5 +- .../LibJS/Runtime/3rdparty/webkit/overflow.js | 62 ------------------- .../Runtime/3rdparty/webkit/parentheses.js | 4 ++ .../Runtime/3rdparty/webkit/pcre-test-1.js | 6 +- .../Runtime/3rdparty/webkit/pcre-test-4.js | 4 ++ .../3rdparty/webkit/quantified-assertions.js | 5 +- .../3rdparty/webkit/repeat-match-waldemar.js | 4 ++ Tests/LibJS/Runtime/3rdparty/webkit/slow.js | 15 ++--- .../3rdparty/webkit/string-split-newline.js | 4 ++ .../LibJS/Runtime/3rdparty/webkit/toString.js | 4 ++ .../3rdparty/webkit/unicodeCaseInsensitive.js | 4 ++ 23 files changed, 95 insertions(+), 86 deletions(-) delete mode 100644 Tests/LibJS/Runtime/3rdparty/webkit/overflow.js diff --git a/Meta/import-webkit-regexp-tests.py b/Meta/import-webkit-regexp-tests.py index 80d21136cf..3efa44895e 100644 --- a/Meta/import-webkit-regexp-tests.py +++ b/Meta/import-webkit-regexp-tests.py @@ -19,6 +19,10 @@ function description(msg) { // No-op, just used for test documentation in WebKit. } +function debug(msg) { + // No-op, just used for debugging in WebKit tests. +} + function shouldBe(actual_code, expected_code) { let actual = eval(actual_code); let expected = eval(expected_code); @@ -69,23 +73,16 @@ DEST_DIR = "Tests/LibJS/Runtime/3rdparty/webkit" # Files to skip entirely. SKIP_FILES = { "TEMPLATE.html", + # Tests WebKit-specific overflow rejection for huge quantifiers. + # Ladybird, Chrome, and Firefox just clamp them silently. + "overflow.js", } # Tests that crash or hang -- use test.skip(). -SKIP_TESTS = { - # Crashes (SIGSEGV). - "pcre-test-1", -} +SKIP_TESTS = {} # Tests that fail -- use test.xfail(). XFAIL_TESTS = { - "backreferences", - "dotstar", - "malformed-escapes", - "non-pattern-characters", - "overflow", - "quantified-assertions", - "repeat-match-waldemar", "slow", } diff --git a/Tests/LibJS/Runtime/3rdparty/webkit/alternative-length-miscalculation.js b/Tests/LibJS/Runtime/3rdparty/webkit/alternative-length-miscalculation.js index 44ab695e04..ff7813d426 100644 --- a/Tests/LibJS/Runtime/3rdparty/webkit/alternative-length-miscalculation.js +++ b/Tests/LibJS/Runtime/3rdparty/webkit/alternative-length-miscalculation.js @@ -5,6 +5,10 @@ test("alternative-length-miscalculation", () => { // No-op, just used for test documentation in WebKit. } + function debug(msg) { + // No-op, just used for debugging in WebKit tests. + } + function shouldBe(actual_code, expected_code) { let actual = eval(actual_code); let expected = eval(expected_code); diff --git a/Tests/LibJS/Runtime/3rdparty/webkit/assertion.js b/Tests/LibJS/Runtime/3rdparty/webkit/assertion.js index f27e3515df..a43878744a 100644 --- a/Tests/LibJS/Runtime/3rdparty/webkit/assertion.js +++ b/Tests/LibJS/Runtime/3rdparty/webkit/assertion.js @@ -5,6 +5,10 @@ test("assertion", () => { // No-op, just used for test documentation in WebKit. } + function debug(msg) { + // No-op, just used for debugging in WebKit tests. + } + function shouldBe(actual_code, expected_code) { let actual = eval(actual_code); let expected = eval(expected_code); diff --git a/Tests/LibJS/Runtime/3rdparty/webkit/backreferences.js b/Tests/LibJS/Runtime/3rdparty/webkit/backreferences.js index 093af33f32..3085c4d1cb 100644 --- a/Tests/LibJS/Runtime/3rdparty/webkit/backreferences.js +++ b/Tests/LibJS/Runtime/3rdparty/webkit/backreferences.js @@ -5,6 +5,10 @@ test("backreferences", () => { // No-op, just used for test documentation in WebKit. } + function debug(msg) { + // No-op, just used for debugging in WebKit tests. + } + function shouldBe(actual_code, expected_code) { let actual = eval(actual_code); let expected = eval(expected_code); diff --git a/Tests/LibJS/Runtime/3rdparty/webkit/constructor.js b/Tests/LibJS/Runtime/3rdparty/webkit/constructor.js index 53913a53aa..c41099017a 100644 --- a/Tests/LibJS/Runtime/3rdparty/webkit/constructor.js +++ b/Tests/LibJS/Runtime/3rdparty/webkit/constructor.js @@ -5,6 +5,10 @@ test("constructor", () => { // No-op, just used for test documentation in WebKit. } + function debug(msg) { + // No-op, just used for debugging in WebKit tests. + } + function shouldBe(actual_code, expected_code) { let actual = eval(actual_code); let expected = eval(expected_code); diff --git a/Tests/LibJS/Runtime/3rdparty/webkit/dotstar.js b/Tests/LibJS/Runtime/3rdparty/webkit/dotstar.js index 4306f357eb..710806470f 100644 --- a/Tests/LibJS/Runtime/3rdparty/webkit/dotstar.js +++ b/Tests/LibJS/Runtime/3rdparty/webkit/dotstar.js @@ -5,6 +5,10 @@ test("dotstar", () => { // No-op, just used for test documentation in WebKit. } + function debug(msg) { + // No-op, just used for debugging in WebKit tests. + } + function shouldBe(actual_code, expected_code) { let actual = eval(actual_code); let expected = eval(expected_code); diff --git a/Tests/LibJS/Runtime/3rdparty/webkit/early-acid3-86.js b/Tests/LibJS/Runtime/3rdparty/webkit/early-acid3-86.js index 75e31e972f..3d58ed4902 100644 --- a/Tests/LibJS/Runtime/3rdparty/webkit/early-acid3-86.js +++ b/Tests/LibJS/Runtime/3rdparty/webkit/early-acid3-86.js @@ -5,6 +5,10 @@ test("early-acid3-86", () => { // No-op, just used for test documentation in WebKit. } + function debug(msg) { + // No-op, just used for debugging in WebKit tests. + } + function shouldBe(actual_code, expected_code) { let actual = eval(actual_code); let expected = eval(expected_code); diff --git a/Tests/LibJS/Runtime/3rdparty/webkit/ecma-regex-examples.js b/Tests/LibJS/Runtime/3rdparty/webkit/ecma-regex-examples.js index 7659d2b342..ae3b180ad6 100644 --- a/Tests/LibJS/Runtime/3rdparty/webkit/ecma-regex-examples.js +++ b/Tests/LibJS/Runtime/3rdparty/webkit/ecma-regex-examples.js @@ -5,6 +5,10 @@ test("ecma-regex-examples", () => { // No-op, just used for test documentation in WebKit. } + function debug(msg) { + // No-op, just used for debugging in WebKit tests. + } + function shouldBe(actual_code, expected_code) { let actual = eval(actual_code); let expected = eval(expected_code); diff --git a/Tests/LibJS/Runtime/3rdparty/webkit/invalid-range-in-class.js b/Tests/LibJS/Runtime/3rdparty/webkit/invalid-range-in-class.js index 7f34cd9309..1a7ee7d18a 100644 --- a/Tests/LibJS/Runtime/3rdparty/webkit/invalid-range-in-class.js +++ b/Tests/LibJS/Runtime/3rdparty/webkit/invalid-range-in-class.js @@ -5,6 +5,10 @@ test("invalid-range-in-class", () => { // No-op, just used for test documentation in WebKit. } + function debug(msg) { + // No-op, just used for debugging in WebKit tests. + } + function shouldBe(actual_code, expected_code) { let actual = eval(actual_code); let expected = eval(expected_code); diff --git a/Tests/LibJS/Runtime/3rdparty/webkit/lastIndex.js b/Tests/LibJS/Runtime/3rdparty/webkit/lastIndex.js index 78a6f18e4e..3daa3d585f 100644 --- a/Tests/LibJS/Runtime/3rdparty/webkit/lastIndex.js +++ b/Tests/LibJS/Runtime/3rdparty/webkit/lastIndex.js @@ -5,6 +5,10 @@ test("lastIndex", () => { // No-op, just used for test documentation in WebKit. } + function debug(msg) { + // No-op, just used for debugging in WebKit tests. + } + function shouldBe(actual_code, expected_code) { let actual = eval(actual_code); let expected = eval(expected_code); diff --git a/Tests/LibJS/Runtime/3rdparty/webkit/malformed-escapes.js b/Tests/LibJS/Runtime/3rdparty/webkit/malformed-escapes.js index 7eb3ec814e..bfd630fd24 100644 --- a/Tests/LibJS/Runtime/3rdparty/webkit/malformed-escapes.js +++ b/Tests/LibJS/Runtime/3rdparty/webkit/malformed-escapes.js @@ -1,11 +1,14 @@ test("malformed-escapes", () => { // WebKit assertion compatibility shim for Ladybird's test-js harness - function debug(msg) {} function description(msg) { // No-op, just used for test documentation in WebKit. } + function debug(msg) { + // No-op, just used for debugging in WebKit tests. + } + function shouldBe(actual_code, expected_code) { let actual = eval(actual_code); let expected = eval(expected_code); diff --git a/Tests/LibJS/Runtime/3rdparty/webkit/non-capturing-backtracking.js b/Tests/LibJS/Runtime/3rdparty/webkit/non-capturing-backtracking.js index ab1f3534a0..a65fec65af 100644 --- a/Tests/LibJS/Runtime/3rdparty/webkit/non-capturing-backtracking.js +++ b/Tests/LibJS/Runtime/3rdparty/webkit/non-capturing-backtracking.js @@ -5,6 +5,10 @@ test("non-capturing-backtracking", () => { // No-op, just used for test documentation in WebKit. } + function debug(msg) { + // No-op, just used for debugging in WebKit tests. + } + function shouldBe(actual_code, expected_code) { let actual = eval(actual_code); let expected = eval(expected_code); diff --git a/Tests/LibJS/Runtime/3rdparty/webkit/non-pattern-characters.js b/Tests/LibJS/Runtime/3rdparty/webkit/non-pattern-characters.js index e67a4c9840..9c339c7532 100644 --- a/Tests/LibJS/Runtime/3rdparty/webkit/non-pattern-characters.js +++ b/Tests/LibJS/Runtime/3rdparty/webkit/non-pattern-characters.js @@ -1,11 +1,14 @@ test("non-pattern-characters", () => { // WebKit assertion compatibility shim for Ladybird's test-js harness - function debug(msg) {} function description(msg) { // No-op, just used for test documentation in WebKit. } + function debug(msg) { + // No-op, just used for debugging in WebKit tests. + } + function shouldBe(actual_code, expected_code) { let actual = eval(actual_code); let expected = eval(expected_code); diff --git a/Tests/LibJS/Runtime/3rdparty/webkit/overflow.js b/Tests/LibJS/Runtime/3rdparty/webkit/overflow.js deleted file mode 100644 index ec4318768d..0000000000 --- a/Tests/LibJS/Runtime/3rdparty/webkit/overflow.js +++ /dev/null @@ -1,62 +0,0 @@ -test("overflow", () => { - // WebKit assertion compatibility shim for Ladybird's test-js harness - - function description(msg) { - // No-op, just used for test documentation in WebKit. - } - - function shouldBe(actual_code, expected_code) { - let actual = eval(actual_code); - let expected = eval(expected_code); - if (typeof actual === "string" && typeof expected === "string") { - expect(actual).toBe(expected); - } else if (Array.isArray(actual) && Array.isArray(expected)) { - expect(actual).toEqual(expected); - } else if (actual !== null && typeof actual === "object" && expected !== null && typeof expected === "object") { - expect(actual).toEqual(expected); - } else { - expect(actual).toBe(expected); - } - } - - function shouldBeTrue(code) { - expect(eval(code)).toBeTrue(); - } - - function shouldBeFalse(code) { - expect(eval(code)).toBeFalse(); - } - - function shouldBeNull(code) { - expect(eval(code)).toBeNull(); - } - - function shouldBeUndefined(code) { - expect(eval(code)).toBeUndefined(); - } - - function shouldThrow(code, expected_error) { - expect(() => eval(code)).toThrow(); - } - - function shouldNotThrow(code) { - eval(code); - } - - description("This test checks expressions with alternative lengths of appox. 2^31."); - - var regexp1 = /(?:(?=g))|(?:m).{2147483648,}/; - shouldBe("regexp1.exec('')", "null"); - - var regexp2 = /(?:(?=g)).{2147483648,}/; - shouldBe("regexp2.exec('')", "null"); - - var s3 = "&{6}u4a64YfQP{C}u88c4u5772Qu8693{4294967167}u85f2u7f3fs((uf202){4})u5bc6u1947"; - var regexp3 = new RegExp(s3, ""); - shouldBe("regexp3.exec(s3)", "null"); - - // Large quantifier values are saturated rather than rejected (matching V8 behavior - // and the test262 quantifier-integer-limit test which requires accepting 2^53-1). - shouldNotThrow("function f() { /[^a$]{18446744073709551615}/ }"); - shouldNotThrow("new RegExp('((?=$))??(?:\\\\1){1180591620717411303423,}')"); -}); diff --git a/Tests/LibJS/Runtime/3rdparty/webkit/parentheses.js b/Tests/LibJS/Runtime/3rdparty/webkit/parentheses.js index 8ff3642f0d..85616a3c57 100644 --- a/Tests/LibJS/Runtime/3rdparty/webkit/parentheses.js +++ b/Tests/LibJS/Runtime/3rdparty/webkit/parentheses.js @@ -5,6 +5,10 @@ test("parentheses", () => { // No-op, just used for test documentation in WebKit. } + function debug(msg) { + // No-op, just used for debugging in WebKit tests. + } + function shouldBe(actual_code, expected_code) { let actual = eval(actual_code); let expected = eval(expected_code); diff --git a/Tests/LibJS/Runtime/3rdparty/webkit/pcre-test-1.js b/Tests/LibJS/Runtime/3rdparty/webkit/pcre-test-1.js index 8c73b43472..0ce2edf8a1 100644 --- a/Tests/LibJS/Runtime/3rdparty/webkit/pcre-test-1.js +++ b/Tests/LibJS/Runtime/3rdparty/webkit/pcre-test-1.js @@ -1,10 +1,14 @@ -test.skip("pcre-test-1", () => { +test("pcre-test-1", () => { // WebKit assertion compatibility shim for Ladybird's test-js harness function description(msg) { // No-op, just used for test documentation in WebKit. } + function debug(msg) { + // No-op, just used for debugging in WebKit tests. + } + function shouldBe(actual_code, expected_code) { let actual = eval(actual_code); let expected = eval(expected_code); diff --git a/Tests/LibJS/Runtime/3rdparty/webkit/pcre-test-4.js b/Tests/LibJS/Runtime/3rdparty/webkit/pcre-test-4.js index 6e7370099a..4c031b52fd 100644 --- a/Tests/LibJS/Runtime/3rdparty/webkit/pcre-test-4.js +++ b/Tests/LibJS/Runtime/3rdparty/webkit/pcre-test-4.js @@ -5,6 +5,10 @@ test("pcre-test-4", () => { // No-op, just used for test documentation in WebKit. } + function debug(msg) { + // No-op, just used for debugging in WebKit tests. + } + function shouldBe(actual_code, expected_code) { let actual = eval(actual_code); let expected = eval(expected_code); diff --git a/Tests/LibJS/Runtime/3rdparty/webkit/quantified-assertions.js b/Tests/LibJS/Runtime/3rdparty/webkit/quantified-assertions.js index c6fe850e25..4a2f8d3abb 100644 --- a/Tests/LibJS/Runtime/3rdparty/webkit/quantified-assertions.js +++ b/Tests/LibJS/Runtime/3rdparty/webkit/quantified-assertions.js @@ -1,11 +1,14 @@ test("quantified-assertions", () => { // WebKit assertion compatibility shim for Ladybird's test-js harness - function debug(msg) {} function description(msg) { // No-op, just used for test documentation in WebKit. } + function debug(msg) { + // No-op, just used for debugging in WebKit tests. + } + function shouldBe(actual_code, expected_code) { let actual = eval(actual_code); let expected = eval(expected_code); diff --git a/Tests/LibJS/Runtime/3rdparty/webkit/repeat-match-waldemar.js b/Tests/LibJS/Runtime/3rdparty/webkit/repeat-match-waldemar.js index 9e628b2335..7460ac011b 100644 --- a/Tests/LibJS/Runtime/3rdparty/webkit/repeat-match-waldemar.js +++ b/Tests/LibJS/Runtime/3rdparty/webkit/repeat-match-waldemar.js @@ -5,6 +5,10 @@ test("repeat-match-waldemar", () => { // No-op, just used for test documentation in WebKit. } + function debug(msg) { + // No-op, just used for debugging in WebKit tests. + } + function shouldBe(actual_code, expected_code) { let actual = eval(actual_code); let expected = eval(expected_code); diff --git a/Tests/LibJS/Runtime/3rdparty/webkit/slow.js b/Tests/LibJS/Runtime/3rdparty/webkit/slow.js index 6aef251471..b2200d6780 100644 --- a/Tests/LibJS/Runtime/3rdparty/webkit/slow.js +++ b/Tests/LibJS/Runtime/3rdparty/webkit/slow.js @@ -1,10 +1,14 @@ -test("slow", () => { +test.xfail("slow", () => { // WebKit assertion compatibility shim for Ladybird's test-js harness function description(msg) { // No-op, just used for test documentation in WebKit. } + function debug(msg) { + // No-op, just used for debugging in WebKit tests. + } + function shouldBe(actual_code, expected_code) { let actual = eval(actual_code); let expected = eval(expected_code); @@ -47,12 +51,5 @@ test("slow", () => { "Test for expressions that would hang when evaluated due to exponential matching behavior. If the test does not hang it is a success." ); - // This pattern triggers exponential backtracking. The engine may either - // return false (if it completes within the step limit) or throw an - // InternalError (if the backtrack limit is exceeded). Both are correct. - try { - shouldBe('/(?:[^(?!)]||){23}z/.test("/(?:[^(?!)]||){23}z/")', "false"); - } catch (e) { - expect(e).toBeInstanceOf(InternalError); - } + shouldBe('/(?:[^(?!)]||){23}z/.test("/(?:[^(?!)]||){23}z/")', "false"); }); diff --git a/Tests/LibJS/Runtime/3rdparty/webkit/string-split-newline.js b/Tests/LibJS/Runtime/3rdparty/webkit/string-split-newline.js index e82a8e1369..b3f81102be 100644 --- a/Tests/LibJS/Runtime/3rdparty/webkit/string-split-newline.js +++ b/Tests/LibJS/Runtime/3rdparty/webkit/string-split-newline.js @@ -5,6 +5,10 @@ test("string-split-newline", () => { // No-op, just used for test documentation in WebKit. } + function debug(msg) { + // No-op, just used for debugging in WebKit tests. + } + function shouldBe(actual_code, expected_code) { let actual = eval(actual_code); let expected = eval(expected_code); diff --git a/Tests/LibJS/Runtime/3rdparty/webkit/toString.js b/Tests/LibJS/Runtime/3rdparty/webkit/toString.js index 3a21a31c0b..95a3769bf3 100644 --- a/Tests/LibJS/Runtime/3rdparty/webkit/toString.js +++ b/Tests/LibJS/Runtime/3rdparty/webkit/toString.js @@ -5,6 +5,10 @@ test("toString", () => { // No-op, just used for test documentation in WebKit. } + function debug(msg) { + // No-op, just used for debugging in WebKit tests. + } + function shouldBe(actual_code, expected_code) { let actual = eval(actual_code); let expected = eval(expected_code); diff --git a/Tests/LibJS/Runtime/3rdparty/webkit/unicodeCaseInsensitive.js b/Tests/LibJS/Runtime/3rdparty/webkit/unicodeCaseInsensitive.js index c8ae26af8c..0e9ddbb597 100644 --- a/Tests/LibJS/Runtime/3rdparty/webkit/unicodeCaseInsensitive.js +++ b/Tests/LibJS/Runtime/3rdparty/webkit/unicodeCaseInsensitive.js @@ -5,6 +5,10 @@ test("unicodeCaseInsensitive", () => { // No-op, just used for test documentation in WebKit. } + function debug(msg) { + // No-op, just used for debugging in WebKit tests. + } + function shouldBe(actual_code, expected_code) { let actual = eval(actual_code); let expected = eval(expected_code);