| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 Object.defineProperty(receiver2, "bla", | 266 Object.defineProperty(receiver2, "bla", |
| 267 {configurable: false, writable: true, value: true}); | 267 {configurable: false, writable: true, value: true}); |
| 268 Object.defineProperty(receiver2, "not_in_target", | 268 Object.defineProperty(receiver2, "not_in_target", |
| 269 {configurable: false, writable: true, value: true}); | 269 {configurable: false, writable: true, value: true}); |
| 270 assertTrue(Reflect.set(target, "bla", value, receiver2)); | 270 assertTrue(Reflect.set(target, "bla", value, receiver2)); |
| 271 assertTrue(Reflect.set(target, "not_in_target", value, receiver2)); | 271 assertTrue(Reflect.set(target, "not_in_target", value, receiver2)); |
| 272 } | 272 } |
| 273 })(); | 273 })(); |
| 274 | 274 |
| 275 | 275 |
| 276 (function testReflectSetArrayLength() { |
| 277 var y = []; |
| 278 Object.defineProperty(y, 0, {value: 42, configurable: false}); |
| 279 assertFalse(Reflect.set(y, 'length', 0)); |
| 280 assertTrue(Reflect.set(y, 'length', 2)); |
| 281 })(); |
| 282 |
| 283 |
| 276 | 284 |
| 277 //////////////////////////////////////////////////////////////////////////////// | 285 //////////////////////////////////////////////////////////////////////////////// |
| 278 // Reflect.has | 286 // Reflect.has |
| 279 | 287 |
| 280 | 288 |
| 281 (function testReflectHasArity() { | 289 (function testReflectHasArity() { |
| 282 assertEquals(2, Reflect.has.length); | 290 assertEquals(2, Reflect.has.length); |
| 283 })(); | 291 })(); |
| 284 | 292 |
| 285 | 293 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 (function testReflectDefinePropertyKeyConversion() { | 353 (function testReflectDefinePropertyKeyConversion() { |
| 346 var target = {}; | 354 var target = {}; |
| 347 var a = { [Symbol.toPrimitive]: function() { return "bla" } }; | 355 var a = { [Symbol.toPrimitive]: function() { return "bla" } }; |
| 348 var b = { [Symbol.toPrimitive]: function() { throw "gaga" } }; | 356 var b = { [Symbol.toPrimitive]: function() { throw "gaga" } }; |
| 349 assertTrue(Reflect.defineProperty(target, a, {value: 42})); | 357 assertTrue(Reflect.defineProperty(target, a, {value: 42})); |
| 350 assertEquals(target.bla, 42); | 358 assertEquals(target.bla, 42); |
| 351 assertThrowsEquals(function() { Reflect.defineProperty(target, b); }, "gaga"); | 359 assertThrowsEquals(function() { Reflect.defineProperty(target, b); }, "gaga"); |
| 352 })(); | 360 })(); |
| 353 | 361 |
| 354 | 362 |
| 363 (function testReflectDefinePropertyArrayLength() { |
| 364 var y = []; |
| 365 Object.defineProperty(y, 0, {value: 42, configurable: false}); |
| 366 assertFalse(Reflect.defineProperty(y, 'length', {value: 0})); |
| 367 assertTrue(Reflect.defineProperty(y, 'length', {value: 2})); |
| 368 })(); |
| 369 |
| 370 |
| 355 // See reflect-define-property.js for further tests. | 371 // See reflect-define-property.js for further tests. |
| 356 | 372 |
| 357 | 373 |
| 358 | 374 |
| 359 //////////////////////////////////////////////////////////////////////////////// | 375 //////////////////////////////////////////////////////////////////////////////// |
| 360 // Reflect.deleteProperty | 376 // Reflect.deleteProperty |
| 361 | 377 |
| 362 | 378 |
| 363 (function testReflectDeletePropertyArity() { | 379 (function testReflectDeletePropertyArity() { |
| 364 assertEquals(2, Reflect.deleteProperty.length); | 380 assertEquals(2, Reflect.deleteProperty.length); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 assertThrows(function() { Reflect.preventExtensions(); }, TypeError); | 584 assertThrows(function() { Reflect.preventExtensions(); }, TypeError); |
| 569 assertThrows(function() { Reflect.preventExtensions(42); }, TypeError); | 585 assertThrows(function() { Reflect.preventExtensions(42); }, TypeError); |
| 570 assertThrows(function() { Reflect.preventExtensions(null); }, TypeError); | 586 assertThrows(function() { Reflect.preventExtensions(null); }, TypeError); |
| 571 })(); | 587 })(); |
| 572 | 588 |
| 573 | 589 |
| 574 // See reflect-prevent-extensions.js for further tests. | 590 // See reflect-prevent-extensions.js for further tests. |
| 575 | 591 |
| 576 // TODO(neis): Need proxies to test the situation where | 592 // TODO(neis): Need proxies to test the situation where |
| 577 // [[preventExtensions]] returns false. | 593 // [[preventExtensions]] returns false. |
| OLD | NEW |