blob: e3d5701f5234a464c9a7c6dbb0add06ad4ab3c2b [file] [log] [blame]
<p>This page tests the evaluated value of a do-while expression.</p>
<pre id="console"></pre>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
function log(s)
{
document.getElementById("console").appendChild(document.createTextNode(s + "\n"));
}
function shouldBe(a, b)
{
var evalA;
try {
evalA = eval(a);
} catch(e) {
evalA = e;
}
if (evalA === b) {
log("PASS: " + a + " should be " + b + " and is.");
} else {
log("FAIL: " + a + " should be " + b + " but instead is " + evalA + ".");
}
}
var x;
x = eval("do { 1; } while(0);");
shouldBe("x", 1);
var x = eval("do { 1; break; } while(0);");
shouldBe("x", 1);
var x = eval("do { 1; continue; } while(0);");
shouldBe("x", 1);
var x = eval("do { 1; ; } while(0);");
shouldBe("x", 1);
</script>