Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / trivial-functions.html
blobcd990f340688887f9b9fc7b8b1efdba0e12f71e2
1 <p>Tests for compilation errors in trivial functions.</p>
2 <pre id="console"></pre>
4 <p id="p"></p>
6 <script>
7 function $(id)
9 return document.getElementById(id);
12 function log(s)
14 $("console").appendChild(document.createTextNode(s + "\n"));
17 function shouldBe(aDescription, a, b)
19 if (a == b) {
20 log("PASS: " + aDescription + " should be " + b + " and is.");
21 return;
24 log("FAIL: " + aDescription + " should be " + b + " but instead is " + a + ".");
27 function f1(a, b) { return a[b]; }
28 function f2(a, b, c) { return a[b] = c; }
30 if (window.testRunner)
31 testRunner.dumpAsText();
33 shouldBe("f1(0, 0)", f1(0, 0), undefined);
34 shouldBe("f2(0, 0, 0)", f2(0, 0, 0), 0);
35 </script>