blob: 32db0b81f37280b4232297f8f4dbad1a06255e37 (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
test("Issue #1829, if-else without braces or semicolons", () => {
const source = `if (1)
foo;
else
bar;
if (1)
foo
else
bar
if (1)
foo
else
bar;`;
expect(source).toEval();
});
test("break/continue, variable declaration, do-while, and return asi", () => {
const source = `function foo() {
label:
for (var i = 0; i < 4; i++) {
break // semicolon inserted here
continue // semicolon inserted here
break label // semicolon inserted here
continue label // semicolon inserted here
}
var j // semicolon inserted here
do {
} while (1 === 2) // semicolon inserted here
return // semicolon inserted here
1;
var curly/* semicolon inserted here */}
foo();`;
expect(source).toEvalTo(undefined);
});
test("more break and continue asi", () => {
const source = `let counter = 0;
let outer;
outer:
for (let i = 0; i < 5; ++i) {
for (let j = 0; j < 5; ++j) {
continue // semicolon inserted here
outer // semicolon inserted here
}
counter++;
}
counter;`;
expect(source).toEvalTo(5);
});
test("eof with no semicolon", () => {
expect("var eof").toEval();
});
|