summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Tests/Error.js
blob: ed920cb9ba7c79963f38983e59d3e73ef8d92a45 (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
load("test-common.js");

try {
    assert(Error.length === 1);
    assert(Error.name === "Error");
    assert(Error.prototype.length === undefined);

    var e;

    e = Error();
    assert(e.name === "Error");
    assert(e.message === "");

    e = Error(undefined);
    assert(e.name === "Error");
    assert(e.message === "");

    e = Error("test");
    assert(e.name === "Error");
    assert(e.message === "test");

    e = Error(42);
    assert(e.name === "Error");
    assert(e.message === "42");

    e = Error(null);
    assert(e.name === "Error");
    assert(e.message === "null");

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