summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/regexp/bug1640473.js
blob: d2ba97043defe6b6a0c0e8ea6326a51ff7e4f0c0 (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";
}

try {
  var r = RegExp(s);
  var e = r.exec(input);

  for (var i = 0; i < 500; i++) {
    assertEq(e.groups["a" + i], "a");
    assertEq(e.groups["b" + i], undefined);
  }
} catch (err) {
  assertEq(err.message, "too much recursion");
}