Index: test/mjsunit/es6/function-name.js |
diff --git a/test/mjsunit/es6/function-name.js b/test/mjsunit/es6/function-name.js |
index 12cb3e6db1640727b3aa689d017bd57abe5816ed..95bc2d44164aefd7d1d31414d99c1adda03b5391 100644 |
--- a/test/mjsunit/es6/function-name.js |
+++ b/test/mjsunit/es6/function-name.js |
@@ -386,3 +386,39 @@ |
class C { static name() { } static foo() { } } |
assertEquals(['length', 'prototype', 'name', 'foo'], Object.getOwnPropertyNames(C)); |
})(); |
+ |
nickie
2016/12/13 22:14:44
Guys, please check that these two sets of tests ac
|
+(function testStaticName() { |
+ class C { static name() { return 42; } } |
+ assertEquals(42, C.name()); |
+ assertEquals(undefined, new C().name); |
+ |
+ class D { static get name() { return 17; } } |
+ assertEquals(17, D.name); |
+ assertEquals(undefined, new D().name); |
+ |
+ var c = class { static name() { return 42; } } |
+ assertEquals(42, c.name()); |
+ assertEquals(undefined, new c().name); |
+ |
+ var d = class { static get name() { return 17; } } |
+ assertEquals(17, d.name); |
+ assertEquals(undefined, new d().name); |
+})(); |
+ |
+(function testNonStaticName() { |
+ class C { name() { return 42; } } |
+ assertEquals('C', C.name); |
+ assertEquals(42, new C().name()); |
+ |
+ class D { get name() { return 17; } } |
+ assertEquals('D', D.name); |
+ assertEquals(17, new D().name); |
+ |
+ var c = class { name() { return 42; } } |
+ assertEquals('c', c.name); |
+ assertEquals(42, new c().name()); |
+ |
+ var d = class { get name() { return 17; } } |
+ assertEquals('d', d.name); |
+ assertEquals(17, new d().name); |
+})(); |