summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Tests/strict-mode-errors.js
blob: 430596ca9cd01b9c610e5cc3eb88a71e4e8e104b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"use strict";

load("test-common.js")

try {
    [true, false, "foo", 123].forEach(primitive => {
        assertThrowsError(() => {
            primitive.foo = "bar";
        }, {
            error: TypeError,
            message: "Cannot assign property foo to primitive value"
        });
    });

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