Skip to content

Commit

Permalink
add non-matching example
Browse files Browse the repository at this point in the history
  • Loading branch information
bakkot authored and ptomato committed Aug 9, 2022
1 parent 52284ba commit 418419a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/built-ins/RegExp/named-groups/duplicate-names.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ assert.compareArray(["bb", undefined, "bb"], "bb".match(/(?:(?<x>a)|(?<x>b))\k<x
let matchResult = "aabb".match(/(?:(?:(?<x>a)|(?<x>b))\k<x>){2}/);
assert.compareArray(["aabb", undefined, "bb"], matchResult);
assert.sameValue(matchResult.groups.x, "bb");

let notMatched = "abab".match(/(?:(?:(?<x>a)|(?<x>b))\k<x>){2}/);
assert.sameValue(null, notMatched);

0 comments on commit 418419a

Please sign in to comment.