summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/regexp/match-indices-dictionary.js
blob: e0cb5993f57b0c9074fb9c441ec7b31999663001 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// |jit-test| skip-if: getBuildConfiguration()['wasi']
var s = "";
var input = "";
for (var i = 0; i < 500; ++i) {
    s += "(?<a" + i + ">a)";
    s += "(?<b" + i + ">b)?";
    input += "a";
}

var r = RegExp(s, "d");
var e = r.exec(input);

for (var i = 0; i < 500; i++) {
    assertEq(e.groups["a" + i], "a");
    assertEq(e.groups["b" + i], undefined);

    assertEq(e.indices.groups["a" + i][0], i)
    assertEq(e.indices.groups["a" + i][1], i + 1)
    assertEq(e.indices.groups["b" + i], undefined)
}