| Index: test/mjsunit/harmony/function-name.js
|
| diff --git a/test/mjsunit/harmony/function-name.js b/test/mjsunit/harmony/function-name.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..5da761f3c2ca7823b1a8f1212254610da035f0c0
|
| --- /dev/null
|
| +++ b/test/mjsunit/harmony/function-name.js
|
| @@ -0,0 +1,35 @@
|
| +// Copyright 2015 the V8 project authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +//
|
| +// Flags: --harmony-function-name
|
| +
|
| +(function testVariableDeclarationsFunction() {
|
| + 'use strict';
|
| + var a = function(){};
|
| + assertEquals('a', a.name);
|
| + let b = () => {};
|
| + assertEquals('b', b.name);
|
| + const c = ((function(){}));
|
| + assertEquals('c', c.name);
|
| +
|
| + var x = function(){}, y = () => {}, z = function withName() {};
|
| + assertEquals('x', x.name);
|
| + assertEquals('y', y.name);
|
| + assertEquals('withName', z.name);
|
| +})();
|
| +
|
| +(function testVariableDeclarationsClass() {
|
| + 'use strict';
|
| + var a = class {};
|
| + assertEquals('a', a.name);
|
| + let b = ((class {}));
|
| + assertEquals('b', b.name);
|
| + // Should not overwrite name property.
|
| + const c = class { static name() { } }
|
| + assertEquals('function', typeof c.name);
|
| +
|
| + var x = class {}, y = class NamedClass {};
|
| + assertEquals('x', x.name);
|
| + assertEquals('NamedClass', y.name);
|
| +})();
|
|
|