Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / RegExp / duplicate-named-capturing-groups-syntax.js
blob4064af92a3179ea4f09c5c1cc176e2824e7d651c
1 // |reftest| skip -- regexp-duplicate-named-groups is not supported
2 // Copyright 2022 Igalia, S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
5 /*---
6 esid: sec-regexp-pattern-flags
7 description: Runtime parsing of syntax for duplicate named capturing groups
8 features: [regexp-duplicate-named-groups]
9 ---*/
11 assert.throws(
12   SyntaxError,
13   () => new RegExp("(?<x>a)(?<x>b)"),
14   "Duplicate named capturing groups in the same alternative do not parse"
17 let source = "(?<x>a)|(?<x>b)";
18 let parsed = new RegExp(source);
19 assert.sameValue(parsed.source, source, "Duplicate named capturing groups in separate alternatives parse correctly");
21 reportCompare(0, 0);