blob: eb75baf326b5025b29fb28087d3a9faf876f5374 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
<p>This page tests the evaluated value of a do-while expression.</p>
<pre id="console"></pre>
<script>
if (window.testRunner)
testRunner.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>
|