blob: e18d128d46dfc85eb23ebad6608caa32b04c66b8 [file] [log] [blame]
<p>This test verifies that implicit creation of a regular expression eagerly checks for syntax errors.</p>
<p>If the test passes, you'll see pass messages below.</p>
<pre id="console"></pre>
<script>
function log(s)
{
document.getElementById("console").appendChild(document.createTextNode(s + "\n"));
}
function shouldThrow(program)
{
try {
eval(program);
log("FAIL: " + program + " should throw an exception but didn't");
} catch (e) {
log("PASS: " + program + " should throw an exception and did: " + e + ".");
}
}
if (window.testRunner)
testRunner.dumpAsText();
shouldThrow('"abc".search("[")');
shouldThrow('"abc".match("[")');
</script>