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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 var g = function* () {}; | 366 var g = function* () {}; |
367 var obj = { | 367 var obj = { |
368 ['h']: function () {}, | 368 ['h']: function () {}, |
369 i: () => {} | 369 i: () => {} |
370 }; | 370 }; |
371 assertEquals('function () {}', f.toString()); | 371 assertEquals('function () {}', f.toString()); |
372 assertEquals('function* () {}', g.toString()); | 372 assertEquals('function* () {}', g.toString()); |
373 assertEquals('function () {}', obj.h.toString()); | 373 assertEquals('function () {}', obj.h.toString()); |
374 assertEquals('() => {}', obj.i.toString()); | 374 assertEquals('() => {}', obj.i.toString()); |
375 })(); | 375 })(); |
| 376 |
| 377 (function testClassNameOrder() { |
| 378 assertEquals(['length', 'prototype'], Object.getOwnPropertyNames(class {})); |
| 379 |
| 380 class A { } |
| 381 assertEquals(['length', 'prototype', 'name'], Object.getOwnPropertyNames(A)); |
| 382 |
| 383 class B { static foo() { } } |
| 384 assertEquals(['length', 'prototype', 'foo', 'name'], Object.getOwnPropertyName
s(B)); |
| 385 |
| 386 class C { static name() { } static foo() { } } |
| 387 assertEquals(['length', 'prototype', 'name', 'foo'], Object.getOwnPropertyName
s(C)); |
| 388 })(); |
OLD | NEW |