diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/RegExp/named-groups/duplicate-names-test.js')
-rw-r--r-- | js/src/tests/test262/built-ins/RegExp/named-groups/duplicate-names-test.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/RegExp/named-groups/duplicate-names-test.js b/js/src/tests/test262/built-ins/RegExp/named-groups/duplicate-names-test.js new file mode 100644 index 0000000000..77a8dd4391 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/named-groups/duplicate-names-test.js @@ -0,0 +1,23 @@ +// |reftest| skip -- regexp-duplicate-named-groups is not supported +// Copyright 2022 Igalia S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Matching behavior with duplicate named capture groups +esid: prod-GroupSpecifier +features: [regexp-duplicate-named-groups] +---*/ + +assert(/(?<x>a)|(?<x>b)/.test("bab")); +assert(/(?<x>b)|(?<x>a)/.test("bab")); + +assert(/(?:(?<x>a)|(?<x>b))\k<x>/.test("aa")); +assert(/(?:(?<x>a)|(?<x>b))\k<x>/.test("bb")); + +let matchResult = /(?:(?:(?<x>a)|(?<x>b))\k<x>){2}/.test("aabb"); +assert(matchResult); + +let notMatched = /(?:(?:(?<x>a)|(?<x>b))\k<x>){2}/.test("abab"); +assert.sameValue(notMatched, false); + +reportCompare(0, 0); |