Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / do-while-expression-value.html
blobeb75baf326b5025b29fb28087d3a9faf876f5374
1 <p>This page tests the evaluated value of a do-while expression.</p>
2 <pre id="console"></pre>
4 <script>
5 if (window.testRunner)
6 testRunner.dumpAsText();
8 function log(s)
10 document.getElementById("console").appendChild(document.createTextNode(s + "\n"));
13 function shouldBe(a, b)
15 var evalA;
16 try {
17 evalA = eval(a);
18 } catch(e) {
19 evalA = e;
22 if (evalA === b) {
23 log("PASS: " + a + " should be " + b + " and is.");
24 } else {
25 log("FAIL: " + a + " should be " + b + " but instead is " + evalA + ".");
29 var x;
31 x = eval("do { 1; } while(0);");
32 shouldBe("x", 1);
34 var x = eval("do { 1; break; } while(0);");
35 shouldBe("x", 1);
37 var x = eval("do { 1; continue; } while(0);");
38 shouldBe("x", 1);
40 var x = eval("do { 1; ; } while(0);");
41 shouldBe("x", 1);
43 </script>