summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/staging/built-ins/RegExp/named-groups/duplicate-named-groups.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/staging/built-ins/RegExp/named-groups/duplicate-named-groups.js')
-rw-r--r--js/src/tests/test262/staging/built-ins/RegExp/named-groups/duplicate-named-groups.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/js/src/tests/test262/staging/built-ins/RegExp/named-groups/duplicate-named-groups.js b/js/src/tests/test262/staging/built-ins/RegExp/named-groups/duplicate-named-groups.js
new file mode 100644
index 0000000000..d28346f13b
--- /dev/null
+++ b/js/src/tests/test262/staging/built-ins/RegExp/named-groups/duplicate-named-groups.js
@@ -0,0 +1,19 @@
+// |reftest| skip -- regexp-duplicate-named-groups is not supported
+// Copyright (C) 2024 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Test different functions with duplicate names in alteration.
+features: [regexp-duplicate-named-groups]
+includes: [compareArray.js]
+---*/
+
+assert.compareArray(
+ ['xxyy', undefined, 'y'], /(?:(?:(?<a>x)|(?<a>y))\k<a>){2}/.exec('xxyy'));
+assert.compareArray(
+ ['zzyyxx', 'x', undefined, undefined, undefined, undefined],
+ /(?:(?:(?<a>x)|(?<a>y)|(a)|(?<b>b)|(?<a>z))\k<a>){3}/.exec('xzzyyxxy'));
+assert.compareArray(
+ ['xxyy', undefined, 'y'], 'xxyy'.match(/(?:(?:(?<a>x)|(?<a>y))\k<a>){2}/));
+
+reportCompare(0, 0);