OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 // Flags: --harmony-rest-parameters --harmony-classes | 5 // Flags: --harmony-rest-parameters |
6 | 6 |
7 (function testRestIndex() { | 7 (function testRestIndex() { |
8 assertEquals(5, (function(...args) { return args.length; })(1,2,3,4,5)); | 8 assertEquals(5, (function(...args) { return args.length; })(1,2,3,4,5)); |
9 assertEquals(4, (function(a, ...args) { return args.length; })(1,2,3,4,5)); | 9 assertEquals(4, (function(a, ...args) { return args.length; })(1,2,3,4,5)); |
10 assertEquals(3, (function(a, b, ...args) { return args.length; })(1,2,3,4,5)); | 10 assertEquals(3, (function(a, b, ...args) { return args.length; })(1,2,3,4,5)); |
11 assertEquals(2, (function(a, b, c, ...args) { | 11 assertEquals(2, (function(a, b, c, ...args) { |
12 return args.length; })(1,2,3,4,5)); | 12 return args.length; })(1,2,3,4,5)); |
13 assertEquals(1, (function(a, b, c, d, ...args) { | 13 assertEquals(1, (function(a, b, c, d, ...args) { |
14 return args.length; })(1,2,3,4,5)); | 14 return args.length; })(1,2,3,4,5)); |
15 assertEquals(0, (function(a, b, c, d, e, ...args) { | 15 assertEquals(0, (function(a, b, c, d, e, ...args) { |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 args.push(arguments[i]); | 205 args.push(arguments[i]); |
206 } | 206 } |
207 assertEquals(args, b); | 207 assertEquals(args, b); |
208 } | 208 } |
209 } | 209 } |
210 | 210 |
211 var c = new Child(1, 2, 3); | 211 var c = new Child(1, 2, 3); |
212 assertEquals([1, 2, 3], c.child); | 212 assertEquals([1, 2, 3], c.child); |
213 assertEquals([1, 2, 3], c.base); | 213 assertEquals([1, 2, 3], c.base); |
214 })(); | 214 })(); |
OLD | NEW |