Index: test/mjsunit/harmony/function-name.js |
diff --git a/test/mjsunit/harmony/function-name.js b/test/mjsunit/harmony/function-name.js |
index 8ca5d8209acd988d4273f9abfa3b5d9ebe52fc1b..06ada10ac8055bb5be0784cc70679171f223e7a8 100644 |
--- a/test/mjsunit/harmony/function-name.js |
+++ b/test/mjsunit/harmony/function-name.js |
@@ -3,6 +3,7 @@ |
// found in the LICENSE file. |
// |
// Flags: --harmony-function-name |
+// Flags: --harmony-destructuring-bind --harmony-destructuring-assignment |
(function testVariableDeclarationsFunction() { |
'use strict'; |
@@ -159,3 +160,153 @@ |
classLit = class { constructor() {} static get ['name']() { return true; } }; |
assertTrue(classLit.name); |
})(); |
+ |
+(function testObjectBindingPattern() { |
+ var { |
+ a = function() {}, |
+ b = () => {}, |
+ x = function withName() { }, |
+ y = class { }, |
+ z = class ClassName { }, |
+ q = class { static name() { return 42 } }, |
+ foo: bar = function() {}, |
+ inParens = (() => {}), |
+ inManyParens = ((((() => {})))), |
+ } = {}; |
+ assertEquals('a', a.name); |
+ assertEquals('b', b.name); |
+ assertEquals('withName', x.name); |
+ assertEquals('y', y.name); |
+ assertEquals('ClassName', z.name); |
+ assertEquals('function', typeof q.name); |
+ assertEquals('bar', bar.name); |
+ assertEquals('inParens', inParens.name) |
+ assertEquals('inManyParens', inManyParens.name) |
+})(); |
+ |
+(function testArrayBindingPattern() { |
+ var [ |
+ a = function() {}, |
+ b = () => {}, |
+ x = function withName() { }, |
+ y = class { }, |
+ z = class ClassName { }, |
+ q = class { static name() { return 42 } }, |
+ inParens = (() => {}), |
+ inManyParens = ((((() => {})))), |
+ ] = []; |
+ assertEquals('a', a.name); |
+ assertEquals('b', b.name); |
+ assertEquals('withName', x.name); |
+ assertEquals('y', y.name); |
+ assertEquals('ClassName', z.name); |
+ assertEquals('function', typeof q.name); |
+ assertEquals('inParens', inParens.name) |
+ assertEquals('inManyParens', inManyParens.name) |
+})(); |
+ |
+(function testObjectAssignmentPattern() { |
+ var a, b, x, y, z, q; |
+ ({ |
+ a = function() {}, |
+ b = () => {}, |
+ x = function withName() { }, |
+ y = class { }, |
+ z = class ClassName { }, |
+ q = class { static name() { return 42 } }, |
+ foo: bar = function() {}, |
+ inParens = (() => {}), |
+ inManyParens = ((((() => {})))), |
+ } = {}); |
+ assertEquals('a', a.name); |
+ assertEquals('b', b.name); |
+ assertEquals('withName', x.name); |
+ assertEquals('y', y.name); |
+ assertEquals('ClassName', z.name); |
+ assertEquals('function', typeof q.name); |
+ assertEquals('bar', bar.name); |
+ assertEquals('inParens', inParens.name) |
+ assertEquals('inManyParens', inManyParens.name) |
+})(); |
+ |
+(function testArrayAssignmentPattern() { |
+ var a, b, x, y, z, q; |
+ [ |
+ a = function() {}, |
+ b = () => {}, |
+ x = function withName() { }, |
+ y = class { }, |
+ z = class ClassName { }, |
+ q = class { static name() { return 42 } }, |
+ inParens = (() => {}), |
+ inManyParens = ((((() => {})))), |
+ ] = []; |
+ assertEquals('a', a.name); |
+ assertEquals('b', b.name); |
+ assertEquals('withName', x.name); |
+ assertEquals('y', y.name); |
+ assertEquals('ClassName', z.name); |
+ assertEquals('function', typeof q.name); |
+ assertEquals('inParens', inParens.name) |
+ assertEquals('inManyParens', inManyParens.name) |
+})(); |
+ |
+(function testParameterDestructuring() { |
+ (function({ a = function() {}, |
+ b = () => {}, |
+ x = function withName() { }, |
+ y = class { }, |
+ z = class ClassName { }, |
+ q = class { static name() { return 42 } }, |
+ foo: bar = function() {}, |
+ inParens = (() => {}), |
+ inManyParens = ((((() => {})))) }) { |
+ assertEquals('a', a.name); |
+ assertEquals('b', b.name); |
+ assertEquals('withName', x.name); |
+ assertEquals('y', y.name); |
+ assertEquals('ClassName', z.name); |
+ assertEquals('function', typeof q.name); |
+ assertEquals('bar', bar.name); |
+ assertEquals('inParens', inParens.name) |
+ assertEquals('inManyParens', inManyParens.name) |
+ })({}); |
+ |
+ (function([ a = function() {}, |
+ b = () => {}, |
+ x = function withName() { }, |
+ y = class { }, |
+ z = class ClassName { }, |
+ q = class { static name() { return 42 } }, |
+ inParens = (() => {}), |
+ inManyParens = ((((() => {})))) ]) { |
+ assertEquals('a', a.name); |
+ assertEquals('b', b.name); |
+ assertEquals('withName', x.name); |
+ assertEquals('y', y.name); |
+ assertEquals('ClassName', z.name); |
+ assertEquals('function', typeof q.name); |
+ assertEquals('inParens', inParens.name) |
+ assertEquals('inManyParens', inManyParens.name) |
+ })([]); |
+})(); |
+ |
+(function testDefaultParameters() { |
+ (function(a = function() {}, |
+ b = () => {}, |
+ x = function withName() { }, |
+ y = class { }, |
+ z = class ClassName { }, |
+ q = class { static name() { return 42 } }, |
+ inParens = (() => {}), |
+ inManyParens = ((((() => {}))))) { |
+ assertEquals('a', a.name); |
+ assertEquals('b', b.name); |
+ assertEquals('withName', x.name); |
+ assertEquals('y', y.name); |
+ assertEquals('ClassName', z.name); |
+ assertEquals('function', typeof q.name); |
+ assertEquals('inParens', inParens.name) |
+ assertEquals('inManyParens', inManyParens.name) |
+ })(); |
+})(); |