Index: test/mjsunit/harmony/function-name.js |
diff --git a/test/mjsunit/harmony/function-name.js b/test/mjsunit/harmony/function-name.js |
index af49bc0b2c3b4843b3bda782be397638d005afc5..8ca5d8209acd988d4273f9abfa3b5d9ebe52fc1b 100644 |
--- a/test/mjsunit/harmony/function-name.js |
+++ b/test/mjsunit/harmony/function-name.js |
@@ -120,3 +120,42 @@ |
// Should be '[2]' |
assertEquals('', C[sym2].name); |
})(); |
+ |
+ |
+(function testAssignment() { |
rossberg
2016/01/14 08:01:53
This could take a couple more tests. In particular
|
+ var basicFn, arrowFn, generatorFn, classLit; |
+ |
+ basicFn = function() { return true; }; |
+ assertEquals('basicFn', basicFn.name); |
+ var basicFn2 = basicFn; |
+ assertEquals('basicFn', basicFn2.name); |
+ basicFn = function functionWithName() { }; |
+ assertEquals("functionWithName", basicFn.name); |
+ |
+ arrowFn = x => x; |
+ assertEquals('arrowFn', arrowFn.name); |
+ var arrowFn2 = arrowFn; |
+ assertEquals('arrowFn', arrowFn2.name); |
+ |
+ generatorFn = function*() { yield true; }; |
+ assertEquals('generatorFn', generatorFn.name); |
+ var generatorFn2 = generatorFn; |
+ assertEquals('generatorFn', generatorFn2.name); |
+ generatorFn = function* generatorWithName() { }; |
+ assertEquals("generatorWithName", generatorFn.name); |
+ |
+ classLit = class { constructor() {} }; |
+ assertEquals('classLit', classLit.name); |
+ var classLit2 = classLit; |
+ assertEquals('classLit', classLit2.name); |
+ classLit = class classWithName { constructor() {} }; |
+ assertEquals('classWithName', classLit.name); |
+ classLit = class { constructor() {} static name() {} }; |
+ assertEquals('function', typeof classLit.name); |
+ classLit = class { constructor() {} static get name() { return true; } }; |
+ assertTrue(classLit.name); |
+ classLit = class { constructor() {} static ['name']() {} }; |
+ assertEquals('function', typeof classLit.name); |
+ classLit = class { constructor() {} static get ['name']() { return true; } }; |
+ assertTrue(classLit.name); |
+})(); |