blob: 9a934c01fb66e7a6681d42b3e17807f7bb69e205 (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
load("test-common.js");
try {
assert((function () { }).name === "");
var foo = function () { }
assert(foo.name === "foo");
assert((foo.name = "bar") === "bar");
assert(foo.name === "foo");
var a, b;
a = b = function () { }
assert(a.name === "b");
assert(b.name === "b");
var arr = [
function () { },
function () { },
function () { }
];
assert(arr[0].name === "arr");
assert(arr[1].name === "arr");
assert(arr[2].name === "arr");
var f;
var o = { a: function () { } };
assert(o.a.name === "a");
f = o.a;
assert(f.name === "a");
assert(o.a.name === "a");
o = { ...o, b: f };
assert(o.a.name === "a");
assert(o.b.name === "a");
o.c = function () { };
assert(o.c.name === "c");
function bar() { }
assert(bar.name === "bar");
assert((bar.name = "baz") === "baz");
assert(bar.name === "bar");
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);
}
|