summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/RegExp/named-groups/duplicate-names-match-indices.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/RegExp/named-groups/duplicate-names-match-indices.js')
-rw-r--r--js/src/tests/test262/built-ins/RegExp/named-groups/duplicate-names-match-indices.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/RegExp/named-groups/duplicate-names-match-indices.js b/js/src/tests/test262/built-ins/RegExp/named-groups/duplicate-names-match-indices.js
new file mode 100644
index 0000000000..3135fd75a1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/named-groups/duplicate-names-match-indices.js
@@ -0,0 +1,18 @@
+// |reftest| skip -- regexp-duplicate-named-groups is not supported
+// Copyright 2022 Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: match indices with duplicate named capture groups
+esid: sec-makematchindicesindexpairarray
+features: [regexp-duplicate-named-groups, regexp-match-indices]
+includes: [compareArray.js]
+---*/
+
+let indices = "..ab".match(/(?<x>a)|(?<x>b)/d).indices;
+assert.compareArray(indices.groups.x, [2, 3]);
+
+indices = "..ba".match(/(?<x>a)|(?<x>b)/d).indices;
+assert.compareArray(indices.groups.x, [2, 3]);
+
+reportCompare(0, 0);