summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/regexp/CheckRegExpSyntax.js
blob: d261e6ae072f5ac585577dda42dded9556d3a415 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
load(libdir + "asserts.js");

assertEq(checkRegExpSyntax("correct[reg]exp"), undefined);
let err = checkRegExpSyntax("regex[withSyntaxError");
assertEq(err instanceof SyntaxError, true);

oomTest(() => checkRegExpSyntax("correct(re)gexp"))

var checkReturnedSyntaxError = true;
oomTest(() => {
    let err = checkRegExpSyntax("regex[withSyntaxError");
    if (!(err instanceof SyntaxError)) { checkReturnedSyntaxError = false; }
})
assertEq(checkReturnedSyntaxError, true);