| 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-reflect | 5 // Flags: --harmony-reflect |
| 6 | 6 |
| 7 | 7 |
| 8 (function testReflectConstructArity() { | 8 (function testReflectConstructArity() { |
| 9 assertEquals(2, Reflect.construct.length); | 9 assertEquals(2, Reflect.construct.length); |
| 10 })(); | 10 })(); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 ["T", "E", "S", "T"]).a); | 272 ["T", "E", "S", "T"]).a); |
| 273 assertEquals("TEST!!", Reflect.construct(sumSloppy, | 273 assertEquals("TEST!!", Reflect.construct(sumSloppy, |
| 274 ["T", "E", "S", "T", "!", "!"]).a); | 274 ["T", "E", "S", "T", "!", "!"]).a); |
| 275 assertEquals(10, Reflect.construct(sumSloppy, | 275 assertEquals(10, Reflect.construct(sumSloppy, |
| 276 { 0: 1, 1: 2, 2: 3, 3: 4, length: 4 }).a); | 276 { 0: 1, 1: 2, 2: 3, 3: 4, length: 4 }).a); |
| 277 })(); | 277 })(); |
| 278 | 278 |
| 279 (function() { | 279 (function() { |
| 280 function* f() { yield 1; yield 2; } | 280 function* f() { yield 1; yield 2; } |
| 281 function* g() { yield 3; yield 4; } | 281 function* g() { yield 3; yield 4; } |
| 282 var o = Reflect.construct(f, [], g); | 282 assertThrows(()=>Reflect.construct(f, [], g)); |
| 283 assertEquals([1, 2], [...o]); | |
| 284 assertTrue(o.__proto__ === g.prototype); | |
| 285 assertTrue(o.__proto__ !== f.prototype); | |
| 286 })(); | 283 })(); |
| 287 | 284 |
| 288 (function () { | 285 (function () { |
| 289 var realm1 = Realm.create(); | 286 var realm1 = Realm.create(); |
| 290 var realm2 = Realm.create(); | 287 var realm2 = Realm.create(); |
| 291 | 288 |
| 292 var well_known_intrinsic_constructors = [ | 289 var well_known_intrinsic_constructors = [ |
| 293 "Array", | 290 "Array", |
| 294 "ArrayBuffer", | 291 "ArrayBuffer", |
| 295 "Boolean", | 292 "Boolean", |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 for (var realm of [realm1, realm2]) { | 369 for (var realm of [realm1, realm2]) { |
| 373 test(realm, getname(intrinsic), getargs(intrinsic), convert); | 370 test(realm, getname(intrinsic), getargs(intrinsic), convert); |
| 374 } | 371 } |
| 375 } | 372 } |
| 376 } | 373 } |
| 377 | 374 |
| 378 test_all(test_intrinsic_default, (v)=>v); | 375 test_all(test_intrinsic_default, (v)=>v); |
| 379 test_all(test_intrinsic_default, | 376 test_all(test_intrinsic_default, |
| 380 (v)=>{ "use strict"; return class extends v {}}); | 377 (v)=>{ "use strict"; return class extends v {}}); |
| 381 })(); | 378 })(); |
| OLD | NEW |