Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add core-js/features/string/match-all to test
- Loading branch information
Showing
2 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...gin-transform-named-capturing-groups-regex/test/fixtures/runtime/match-all-corejs/exec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require('core-js/features/string/match-all.js'); | ||
|
||
const string = "Favorite GitHub repos: tc39/ecma262 v8/v8.dev"; | ||
const regex = /\b(?<owner>[a-z0-9]+)\/(?<repo>[a-z0-9\.]+)\b/g; | ||
|
||
const matches = string.matchAll(regex); | ||
|
||
expect(matches.next().value.groups).toEqual({ | ||
owner: "tc39", | ||
repo: "ecma262", | ||
}); | ||
|
||
expect(matches.next().value.groups).toEqual({ | ||
owner: "v8", | ||
repo: "v8.dev", | ||
}); |