OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 // TODO(neis): Test with proxies. | 5 // TODO(neis): Test with proxies. |
6 | 6 |
7 | 7 |
8 | 8 |
9 //////////////////////////////////////////////////////////////////////////////// | 9 //////////////////////////////////////////////////////////////////////////////// |
10 // (Auxiliaries) | 10 // (Auxiliaries) |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 (function testReflectOwnKeysOnObject(){ | 534 (function testReflectOwnKeysOnObject(){ |
535 assertEquals(["z", "y", "x"], Reflect.ownKeys({z: 3, y: 2, x: 1})); | 535 assertEquals(["z", "y", "x"], Reflect.ownKeys({z: 3, y: 2, x: 1})); |
536 assertEquals(["length"], Reflect.ownKeys([])); | 536 assertEquals(["length"], Reflect.ownKeys([])); |
537 | 537 |
538 var s1 = Symbol("foo"); | 538 var s1 = Symbol("foo"); |
539 var s2 = Symbol("bar"); | 539 var s2 = Symbol("bar"); |
540 var obj = { [s1]: 0, "bla": 0, 42: 0, "0": 0, | 540 var obj = { [s1]: 0, "bla": 0, 42: 0, "0": 0, |
541 [s2]: 0, "-1": 0, "88": 0, "aaa": 0 }; | 541 [s2]: 0, "-1": 0, "88": 0, "aaa": 0 }; |
542 assertEquals(["0", "42", "88", "bla", "-1", "aaa", s1, s2], | 542 assertEquals(["0", "42", "88", "bla", "-1", "aaa", s1, s2], |
543 Reflect.ownKeys(obj)); | 543 Reflect.ownKeys(obj)); |
544 // Force dict-mode elements. | |
545 delete obj[0]; | |
546 assertEquals(["42", "88", "bla", "-1", "aaa", s1, s2], | |
547 Reflect.ownKeys(obj)); | |
548 // Force dict-mode properties. | |
549 delete obj["bla"]; | |
550 assertEquals(["42", "88", "-1", "aaa", s1, s2], Reflect.ownKeys(obj)); | |
551 })(); | 544 })(); |
552 | 545 |
553 | 546 |
554 // See reflect-own-keys.js for further tests. | 547 // See reflect-own-keys.js for further tests. |
555 | 548 |
556 | 549 |
557 | 550 |
558 //////////////////////////////////////////////////////////////////////////////// | 551 //////////////////////////////////////////////////////////////////////////////// |
559 // Reflect.preventExtensions | 552 // Reflect.preventExtensions |
560 | 553 |
561 | 554 |
562 (function testReflectPreventExtensionsArity() { | 555 (function testReflectPreventExtensionsArity() { |
563 assertEquals(1, Reflect.preventExtensions.length); | 556 assertEquals(1, Reflect.preventExtensions.length); |
564 })(); | 557 })(); |
565 | 558 |
566 | 559 |
567 (function testReflectPreventExtensionsOnNonObject() { | 560 (function testReflectPreventExtensionsOnNonObject() { |
568 assertThrows(function() { Reflect.preventExtensions(); }, TypeError); | 561 assertThrows(function() { Reflect.preventExtensions(); }, TypeError); |
569 assertThrows(function() { Reflect.preventExtensions(42); }, TypeError); | 562 assertThrows(function() { Reflect.preventExtensions(42); }, TypeError); |
570 assertThrows(function() { Reflect.preventExtensions(null); }, TypeError); | 563 assertThrows(function() { Reflect.preventExtensions(null); }, TypeError); |
571 })(); | 564 })(); |
572 | 565 |
573 | 566 |
574 // See reflect-prevent-extensions.js for further tests. | 567 // See reflect-prevent-extensions.js for further tests. |
575 | 568 |
576 // TODO(neis): Need proxies to test the situation where | 569 // TODO(neis): Need proxies to test the situation where |
577 // [[preventExtensions]] returns false. | 570 // [[preventExtensions]] returns false. |
OLD | NEW |