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
|
<p>Tests for compilation errors in trivial functions.</p>
<pre id="console"></pre>
<p id="p"></p>
<script>
function $(id)
{
return document.getElementById(id);
}
function log(s)
{
$("console").appendChild(document.createTextNode(s + "\n"));
}
function shouldBe(aDescription, a, b)
{
if (a == b) {
log("PASS: " + aDescription + " should be " + b + " and is.");
return;
}
log("FAIL: " + aDescription + " should be " + b + " but instead is " + a + ".");
}
function f1(a, b) { return a[b]; }
function f2(a, b, c) { return a[b] = c; }
if (window.testRunner)
testRunner.dumpAsText();
shouldBe("f1(0, 0)", f1(0, 0), undefined);
shouldBe("f2(0, 0, 0)", f2(0, 0, 0), 0);
</script>
|