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

try {
    try {
        Math.abs(-20) = 40;
        assertNotReached();
    } catch (e) {
        assert(e.name === "ReferenceError");
        assert(e.message === "Invalid left-hand side in assignment");
    }

    try {
        512 = 256;
        assertNotReached();
    } catch (e) {
        assert(e.name === "ReferenceError");
        assert(e.message === "Invalid left-hand side in assignment");
    }

    try {
        "hello world" = "another thing?";
        assertNotReached();
    } catch (e) {
        assert(e.name === "ReferenceError");
        assert(e.message === "Invalid left-hand side in assignment");
    }

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