1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:07:35 +00:00

LibJS: Make RegExp.prototype.toString() spec-compliant

It should use the 'source' and 'flags' properties of the object, and
therefore work with non-RegExp objects as well.
This commit is contained in:
Linus Groh 2020-11-27 23:10:19 +00:00 committed by Andreas Kling
parent ee66eaa1b0
commit b6e5442d55
2 changed files with 19 additions and 3 deletions

View file

@ -2,4 +2,5 @@ test("basic functionality", () => {
expect(RegExp.prototype.toString).toHaveLength(0);
expect(/test/g.toString()).toBe("/test/g");
expect(RegExp.prototype.toString.call({ source: "test", flags: "g" })).toBe("/test/g");
});