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.
This commit is contained in:
aplefull 2026-05-17 13:27:07 +02:00 committed by Jelle Raaijmakers
parent b3bd8884ae
commit 105098131b
23 changed files with 95 additions and 86 deletions

View file

@ -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",
}

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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,}')");
});

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);
}
});

View file

@ -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);

View file

@ -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);

View file

@ -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);