LibJS: Implement global RegExp.prototype.match

Also rename the 'rx' variable to 'regexp_object' to match other RegExp
methods.
This commit is contained in:
Timothy Flynn 2021-07-07 14:11:46 -04:00 committed by Linus Groh
commit 2d0589f93c
Notes: sideshowbarker 2024-07-18 10:07:34 +09:00
2 changed files with 73 additions and 17 deletions

View file

@ -3,6 +3,12 @@ test("basic functionality", () => {
expect("hello friends".match(/hello/)).not.toBeNull();
expect("hello friends".match(/enemies/)).toBeNull();
expect("aaa".match(/a/)).toEqual(["a"]);
expect("aaa".match(/a/g)).toEqual(["a", "a", "a"]);
expect("aaa".match(/b/)).toBeNull();
expect("aaa".match(/b/g)).toBeNull();
});
test("override exec with function", () => {