blob: d4cc7a9f18c7d09bbcb7e1589dfb8bcfd7ae34c7 [file] [log] [blame]
// This test that the beginning of line (bol) optimization throws when we run out of stack space.
//@ requireOptions("-e", "let arrayLength=25000") if $memoryLimited
arrayLength = typeof(arrayLength) === 'undefined' ? 50000 : arrayLength;
let expectedException = "SyntaxError: Invalid regular expression: regular expression too large";
function test()
{
let source = Array(arrayLength).join("(") + /(?:^|:|,)(?:\s*\[)+/g.toString() + Array(arrayLength).join(")");
RegExp(source);
}
try {
test();
} catch(e) {
if (e != expectedException)
throw "Expected \"" + expectedException + "\" exception, but got \"" + e + "\"";
}