Index: test/mjsunit/harmony/rest-params.js |
diff --git a/test/mjsunit/harmony/rest-params.js b/test/mjsunit/harmony/rest-params.js |
index 5bb258ee68ede31e86a6554f2756f00e01b4ac90..341cb3308755207438349ab57e7af42b24cfffdf 100644 |
--- a/test/mjsunit/harmony/rest-params.js |
+++ b/test/mjsunit/harmony/rest-params.js |
@@ -2,7 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-// Flags: --harmony-rest-parameters |
+// Flags: --harmony-rest-parameters --harmony-classes |
(function testRestIndex() { |
assertEquals(5, (function(...args) { return args.length; })(1,2,3,4,5)); |
@@ -180,3 +180,35 @@ var O = { |
assertEquals([], ((...args) => args)()); |
assertEquals([1,2,3], ((...args) => args)(1,2,3)); |
})();*/ |
+ |
+ |
+(function testRestParamsWithNewTarget() { |
+ "use strict"; |
+ class Base { |
+ constructor(...a) { |
+ this.base = a; |
+ assertEquals(arguments.length, a.length); |
+ var args = []; |
+ for (var i = 0; i < arguments.length; ++i) { |
+ args.push(arguments[i]); |
+ } |
+ assertEquals(args, a); |
+ } |
+ } |
+ class Child extends Base { |
+ constructor(...b) { |
+ super(1, 2, 3); |
+ this.child = b; |
+ assertEquals(arguments.length, b.length); |
+ var args = []; |
+ for (var i = 0; i < arguments.length; ++i) { |
+ args.push(arguments[i]); |
+ } |
+ assertEquals(args, b); |
+ } |
+ } |
+ |
+ var c = new Child(1, 2, 3); |
+ assertEquals([1, 2, 3], c.child); |
+ assertEquals([1, 2, 3], c.base); |
+})(); |