summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Tests/automatic-semicolon-insertion.js
blob: bec9c02252e80c1f8789b9e6124eed34c129e857 (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("test-common.js");

/**
 * This file tests automatic semicolon insertion rules.
 * If this file produces syntax errors, something is wrong.
 */

function foo() {
    for (var i = 0; i < 4; i++) {
        break // semicolon inserted here
        continue // 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 */}

try {
    assert(foo() === undefined);

    console.log("PASS");
} catch (e) {
    console.log("FAIL: " + e);
}

// This vardecl must appear exactly at the end of the file (no newline or whitespace after it)
var eof