blob: 20ed79c07ef638b4678b62281802aeb3732aaa40 (
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
|
load("test-common.js");
try {
assertThrowsError(() => {
for (var i = foo; i < 100; ++i) {
assertNotReached();
}
}, {
error: ReferenceError,
message: "'foo' not known"
});
assertThrowsError(() => {
for (var i = 0; i < foo; ++i) {
assertNotReached();
}
}, {
error: ReferenceError,
message: "'foo' not known"
});
var loopCount = 0;
assertThrowsError(() => {
for (var i = 0; i < 100; ++foo) {
loopCount++;
}
}, {
error: ReferenceError,
message: "'foo' not known"
});
assert(loopCount === 1);
console.log("PASS");
} catch (e) {
console.log("FAIL: " + e);
}
|