| 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)); |
| 544 })(); | 551 })(); |
| 545 | 552 |
| 546 | 553 |
| 547 // See reflect-own-keys.js for further tests. | 554 // See reflect-own-keys.js for further tests. |
| 548 | 555 |
| 549 | 556 |
| 550 | 557 |
| 551 //////////////////////////////////////////////////////////////////////////////// | 558 //////////////////////////////////////////////////////////////////////////////// |
| 552 // Reflect.preventExtensions | 559 // Reflect.preventExtensions |
| 553 | 560 |
| 554 | 561 |
| 555 (function testReflectPreventExtensionsArity() { | 562 (function testReflectPreventExtensionsArity() { |
| 556 assertEquals(1, Reflect.preventExtensions.length); | 563 assertEquals(1, Reflect.preventExtensions.length); |
| 557 })(); | 564 })(); |
| 558 | 565 |
| 559 | 566 |
| 560 (function testReflectPreventExtensionsOnNonObject() { | 567 (function testReflectPreventExtensionsOnNonObject() { |
| 561 assertThrows(function() { Reflect.preventExtensions(); }, TypeError); | 568 assertThrows(function() { Reflect.preventExtensions(); }, TypeError); |
| 562 assertThrows(function() { Reflect.preventExtensions(42); }, TypeError); | 569 assertThrows(function() { Reflect.preventExtensions(42); }, TypeError); |
| 563 assertThrows(function() { Reflect.preventExtensions(null); }, TypeError); | 570 assertThrows(function() { Reflect.preventExtensions(null); }, TypeError); |
| 564 })(); | 571 })(); |
| 565 | 572 |
| 566 | 573 |
| 567 // See reflect-prevent-extensions.js for further tests. | 574 // See reflect-prevent-extensions.js for further tests. |
| 568 | 575 |
| 569 // TODO(neis): Need proxies to test the situation where | 576 // TODO(neis): Need proxies to test the situation where |
| 570 // [[preventExtensions]] returns false. | 577 // [[preventExtensions]] returns false. |
| OLD | NEW |