summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/regexp/match-indices-dictionary.js
blob: 14b7fd06307e1103a4a389488deed84071494b1d (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
// |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";
}

try {
  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)
  }
} catch (err) {
  assertEq(err.message, "too much recursion");
}