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
commit b6e5442d55
Notes: sideshowbarker 2024-07-19 01:14:05 +09:00
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");
});