1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-21 21:05:06 +00:00
serenity/Libraries/LibJS/Tests/builtins/RegExp/RegExp.js
Linus Groh 5cb45e4feb LibJS: Make RegExp() constructor spec-compliant
- Default values should depend on arguments being undefined, not being
  missing
- "(?:)" for empty pattern happens in RegExp.prototype.source, not the
  constructor
2020-11-28 01:20:11 +01:00

9 lines
422 B
JavaScript

test("basic functionality", () => {
// FIXME: update when toString is spec-compliant
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");
});