summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Tests/function-name.js
blob: 163dbab8b129178f4cd634dae3b3465e8bcbcb22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
load("test-common.js");

try {
    var f = function () { }
    assert(f.name === "");
    assert((f.name = "f") === "f");
    assert(f.name === "");

    function foo() { }
    assert(foo.name === "foo");
    assert((foo.name = "bar") === "bar");
    assert(foo.name === "foo");

    assert(console.log.name === "log");
    assert((console.log.name = "warn") === "warn");
    assert(console.log.name === "log");

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