Debian Codegraph @

js/src/tests/test262/built-ins/RegExp/named-groups/duplicate-names-match-indices.js

raw
1 // |reftest| shell-option(--enable-regexp-duplicate-named-groups) skip-if(!xulRuntime.shell) -- requires shell-options
2 // Copyright 2022 Kevin Gibbons. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 description: match indices with duplicate named capture groups
7 esid: sec-makematchindicesindexpairarray
8 features: [regexp-duplicate-named-groups, regexp-match-indices]
9 includes: [compareArray.js]
10 ---*/
11
12 let indices = "..ab".match(/(?<x>a)|(?<x>b)/d).indices;
13 assert.compareArray(indices.groups.x, [2, 3]);
14
15 indices = "..ba".match(/(?<x>a)|(?<x>b)/d).indices;
16 assert.compareArray(indices.groups.x, [2, 3]);
17
18 reportCompare(0, 0);