diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/RegExp/duplicate-named-capturing-groups-syntax.js')
-rw-r--r-- | js/src/tests/test262/built-ins/RegExp/duplicate-named-capturing-groups-syntax.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/RegExp/duplicate-named-capturing-groups-syntax.js b/js/src/tests/test262/built-ins/RegExp/duplicate-named-capturing-groups-syntax.js new file mode 100644 index 0000000000..4064af92a3 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/duplicate-named-capturing-groups-syntax.js @@ -0,0 +1,21 @@ +// |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. + +/*--- +esid: sec-regexp-pattern-flags +description: Runtime parsing of syntax for duplicate named capturing groups +features: [regexp-duplicate-named-groups] +---*/ + +assert.throws( + SyntaxError, + () => new RegExp("(?<x>a)(?<x>b)"), + "Duplicate named capturing groups in the same alternative do not parse" +); + +let source = "(?<x>a)|(?<x>b)"; +let parsed = new RegExp(source); +assert.sameValue(parsed.source, source, "Duplicate named capturing groups in separate alternatives parse correctly"); + +reportCompare(0, 0); |