blob: c5b6494aac7a70f93fc241c9ca76026e628d14ea (
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
|
load(libdir + 'asserts.js');
var calls = 0;
function g() {
calls++;
};
function test1() {
for (var i=0; i<20; i++) {
if (i > 18)
g() = 2;
}
}
assertThrowsInstanceOf(test1, ReferenceError);
assertEq(calls, 1);
function test2() {
for (var i=0; i<20; i++) {
if (i > 18)
g()++;
}
}
assertThrowsInstanceOf(test2, ReferenceError);
assertEq(calls, 2);
function test3() {
for (var i=0; i<20; i++) {
if (i > 18)
g() >>= 2;
}
}
assertThrowsInstanceOf(test3, ReferenceError);
assertEq(calls, 3);
|