summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/RegExp/named-groups/duplicate-names-test.js
blob: 77a8dd439158165d91f303f0db563460e24fa32b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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);