mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:37:34 +00:00
LibJS: Implement RegExp.prototype.compile
This is an Annex B extension to RegExp.prototype.
This commit is contained in:
parent
562d4e497b
commit
6337eb52d8
5 changed files with 51 additions and 0 deletions
|
@ -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();
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue