summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/RegExp/named-groups/duplicate-names-group-property-enumeration-order.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/RegExp/named-groups/duplicate-names-group-property-enumeration-order.js')
-rw-r--r--js/src/tests/test262/built-ins/RegExp/named-groups/duplicate-names-group-property-enumeration-order.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/RegExp/named-groups/duplicate-names-group-property-enumeration-order.js b/js/src/tests/test262/built-ins/RegExp/named-groups/duplicate-names-group-property-enumeration-order.js
new file mode 100644
index 0000000000..33a21cbd2e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/named-groups/duplicate-names-group-property-enumeration-order.js
@@ -0,0 +1,27 @@
+// |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: Enumeration order of the groups object with duplicate named capture groups
+esid: prod-GroupSpecifier
+features: [regexp-duplicate-named-groups]
+includes: [compareArray.js]
+---*/
+
+
+let regexp = /(?<y>a)(?<x>a)|(?<x>b)(?<y>b)/;
+
+assert.compareArray(
+ Object.keys(regexp.exec("aa").groups),
+ ["y", "x"],
+ "property enumeration order of the groups object is based on source order, not match order"
+);
+
+assert.compareArray(
+ Object.keys(regexp.exec("bb").groups),
+ ["y", "x"],
+ "property enumeration order of the groups object is based on source order, not match order"
+);
+
+reportCompare(0, 0);