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:
parent
ee66eaa1b0
commit
b6e5442d55
2 changed files with 19 additions and 3 deletions
|
@ -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");
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue