summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Tests/invalid-lhs-in-assignment.js
blob: 5bca7137b65acd689418ef8fc8f30344c501fdc0 (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
load("test-common.js");

try {
    assertThrowsError(() => {
        512 = 256;
    }, {
        error: ReferenceError,
        message: "Invalid left-hand side in assignment"
    });

    assertThrowsError(() => {
        512 = 256;
    }, {
        error: ReferenceError,
        message: "Invalid left-hand side in assignment"
    });

    assertThrowsError(() => {
        "hello world" = "another thing?";
    }, {
        error: ReferenceError,
        message: "Invalid left-hand side in assignment"
    });

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