summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/regexp/CheckRegExpSyntax.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/regexp/CheckRegExpSyntax.js')
-rw-r--r--js/src/jit-test/tests/regexp/CheckRegExpSyntax.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/regexp/CheckRegExpSyntax.js b/js/src/jit-test/tests/regexp/CheckRegExpSyntax.js
new file mode 100644
index 0000000000..19471fdf50
--- /dev/null
+++ b/js/src/jit-test/tests/regexp/CheckRegExpSyntax.js
@@ -0,0 +1,16 @@
+// |jit-test| skip-if: !('oomTest' in this)
+
+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);