mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-18 08:20:44 +00:00
LibJS: Make RegExp.prototype.source spec-compliant
Basically: - And edge case for this object being RegExp.prototype.source - Return "(?:)" for empty pattern - Escape some things properly
This commit is contained in:
parent
b6e5442d55
commit
8a9a7f1677
Notes:
sideshowbarker
2024-07-19 01:14:01 +09:00
Author: https://github.com/linusg
Commit: 8a9a7f1677
Pull-request: https://github.com/SerenityOS/serenity/pull/4190
3 changed files with 36 additions and 5 deletions
|
@ -1,9 +1,8 @@
|
|||
test("basic functionality", () => {
|
||||
// FIXME: update when toString is spec-compliant
|
||||
expect(RegExp().toString()).toBe("//");
|
||||
expect(RegExp(undefined).toString()).toBe("//");
|
||||
expect(RegExp().toString()).toBe("/(?:)/");
|
||||
expect(RegExp(undefined).toString()).toBe("/(?:)/");
|
||||
expect(RegExp("foo").toString()).toBe("/foo/");
|
||||
expect(RegExp("foo", undefined).toString()).toBe("/foo/");
|
||||
expect(RegExp("foo", "g").toString()).toBe("/foo/g");
|
||||
expect(RegExp(undefined, "g").toString()).toBe("//g");
|
||||
expect(RegExp(undefined, "g").toString()).toBe("/(?:)/g");
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue