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

LibJS: Implement RegExp.prototype.compile

This is an Annex B extension to RegExp.prototype.
This commit is contained in:
Timothy Flynn 2021-08-20 10:41:27 -04:00 committed by Andreas Kling
parent 562d4e497b
commit 6337eb52d8
5 changed files with 51 additions and 0 deletions

View file

@ -0,0 +1,17 @@
test("basic functionality", () => {
let re = /foo/;
expect(re.compile.length).toBe(2);
re.compile("bar");
expect(re.test("foo")).toBeFalse();
expect(re.test("bar")).toBeTrue();
expect(re.unicode).toBeFalse();
re.compile("bar", "u");
expect(re.unicode).toBeTrue();
re.compile(/baz/g);
expect(re.global).toBeTrue();
expect(re.test("bar")).toBeFalse();
expect(re.test("baz")).toBeTrue();
});