OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 (function testVariableDeclarationsFunction() { | 5 (function testVariableDeclarationsFunction() { |
6 'use strict'; | 6 'use strict'; |
7 var a = function(){}; | 7 var a = function(){}; |
8 assertEquals('a', a.name); | 8 assertEquals('a', a.name); |
9 let b = () => {}; | 9 let b = () => {}; |
10 assertEquals('b', b.name); | 10 assertEquals('b', b.name); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 'use strict'; | 66 'use strict'; |
67 class C { | 67 class C { |
68 a() { } | 68 a() { } |
69 static b() { } | 69 static b() { } |
70 get c() { } | 70 get c() { } |
71 set c(val) { } | 71 set c(val) { } |
72 42() { } | 72 42() { } |
73 static 43() { } | 73 static 43() { } |
74 get 44() { } | 74 get 44() { } |
75 set 44(val) { } | 75 set 44(val) { } |
| 76 static get constructor() { } |
| 77 static set constructor(val) { } |
76 }; | 78 }; |
77 | 79 |
78 assertEquals('a', C.prototype.a.name); | 80 assertEquals('a', C.prototype.a.name); |
79 assertEquals('b', C.b.name); | 81 assertEquals('b', C.b.name); |
80 var descriptor = Object.getOwnPropertyDescriptor(C.prototype, 'c'); | 82 var descriptor = Object.getOwnPropertyDescriptor(C.prototype, 'c'); |
81 assertEquals('get c', descriptor.get.name); | 83 assertEquals('get c', descriptor.get.name); |
82 assertEquals('set c', descriptor.set.name); | 84 assertEquals('set c', descriptor.set.name); |
83 assertEquals('42', C.prototype[42].name); | 85 assertEquals('42', C.prototype[42].name); |
84 assertEquals('43', C[43].name); | 86 assertEquals('43', C[43].name); |
85 var descriptor = Object.getOwnPropertyDescriptor(C.prototype, '44'); | 87 var descriptor = Object.getOwnPropertyDescriptor(C.prototype, '44'); |
86 assertEquals('get 44', descriptor.get.name); | 88 assertEquals('get 44', descriptor.get.name); |
87 assertEquals('set 44', descriptor.set.name); | 89 assertEquals('set 44', descriptor.set.name); |
| 90 var descriptor = Object.getOwnPropertyDescriptor(C, 'constructor'); |
| 91 assertEquals('get constructor', descriptor.get.name); |
| 92 assertEquals('set constructor', descriptor.set.name); |
88 })(); | 93 })(); |
89 | 94 |
90 (function testComputedProperties() { | 95 (function testComputedProperties() { |
91 'use strict'; | 96 'use strict'; |
92 var a = 'a'; | 97 var a = 'a'; |
93 var b = 'b'; | 98 var b = 'b'; |
94 var sym1 = Symbol('1'); | 99 var sym1 = Symbol('1'); |
95 var sym2 = Symbol('2'); | 100 var sym2 = Symbol('2'); |
96 var sym3 = Symbol('3'); | 101 var sym3 = Symbol('3'); |
97 var symNoDescription = Symbol(); | 102 var symNoDescription = Symbol(); |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 var g = function* () {}; | 366 var g = function* () {}; |
362 var obj = { | 367 var obj = { |
363 ['h']: function () {}, | 368 ['h']: function () {}, |
364 i: () => {} | 369 i: () => {} |
365 }; | 370 }; |
366 assertEquals('function () {}', f.toString()); | 371 assertEquals('function () {}', f.toString()); |
367 assertEquals('function* () {}', g.toString()); | 372 assertEquals('function* () {}', g.toString()); |
368 assertEquals('function () {}', obj.h.toString()); | 373 assertEquals('function () {}', obj.h.toString()); |
369 assertEquals('() => {}', obj.i.toString()); | 374 assertEquals('() => {}', obj.i.toString()); |
370 })(); | 375 })(); |
OLD | NEW |