summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/RegExp/named-groups/duplicate-names-group-property-enumeration-order.js
blob: 33a21cbd2ec5a56521b54e9ad2a0ea87b324ca05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// |reftest| skip -- regexp-duplicate-named-groups is not supported
// Copyright 2022 Kevin Gibbons. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
description: Enumeration order of the groups object with duplicate named capture groups
esid: prod-GroupSpecifier
features: [regexp-duplicate-named-groups]
includes: [compareArray.js]
---*/


let regexp = /(?<y>a)(?<x>a)|(?<x>b)(?<y>b)/;

assert.compareArray(
  Object.keys(regexp.exec("aa").groups),
  ["y", "x"],
  "property enumeration order of the groups object is based on source order, not match order"
);

assert.compareArray(
  Object.keys(regexp.exec("bb").groups),
  ["y", "x"],
  "property enumeration order of the groups object is based on source order, not match order"
);

reportCompare(0, 0);