Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(564)

Side by Side Diff: test/mjsunit/harmony/reflect.js

Issue 1408163005: [es6] Partially implement Reflect.getOwnPropertyDescriptor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: See comment. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // Flags: --harmony-reflect 5 // Flags: --harmony-reflect
6 6
7 // TODO(neis): Test with proxies. 7 // TODO(neis): Test with proxies.
8 8
9 9
10 10
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 assertThrows(function() { Reflect.enumerate(42); }, TypeError); 354 assertThrows(function() { Reflect.enumerate(42); }, TypeError);
355 assertThrows(function() { Reflect.enumerate(null); }, TypeError); 355 assertThrows(function() { Reflect.enumerate(null); }, TypeError);
356 })(); 356 })();
357 357
358 358
359 // See reflect-enumerate*.js for further tests. 359 // See reflect-enumerate*.js for further tests.
360 360
361 361
362 362
363 //////////////////////////////////////////////////////////////////////////////// 363 ////////////////////////////////////////////////////////////////////////////////
364 // Reflect.getOwnPropertyDescriptor
365
366
367 (function testReflectGetOwnPropertyDescriptorArity() {
368 assertEquals(2, Reflect.getOwnPropertyDescriptor.length);
369 })();
370
371
372 (function testReflectGetOwnPropertyDescriptorOnNonObject() {
373 assertThrows(function() { Reflect.getOwnPropertyDescriptor(); }, TypeError);
374 assertThrows(function() { Reflect.getOwnPropertyDescriptor(42); },
375 TypeError);
376 assertThrows(function() { Reflect.getOwnPropertyDescriptor(null); },
377 TypeError);
378 })();
379
380
381 (function testReflectGetOwnPropertyDescriptorKeyConversion() {
382 var tgt = {bla: 42};
383 var a = { [Symbol.toPrimitive]: function() { return "bla" } };
384 var b = { [Symbol.toPrimitive]: function() { throw "gaga" } };
385 assertEquals(42, Reflect.getOwnPropertyDescriptor(tgt, a).value);
386 assertThrows(function() { Reflect.getOwnPropertyDescriptor(tgt, b); },
387 "gaga");
388 })();
389
390
391 // See reflect-get-own-property-descriptor.js for further tests.
392
393
394
395 ////////////////////////////////////////////////////////////////////////////////
364 // Reflect.preventExtensions 396 // Reflect.preventExtensions
365 397
366 398
367 (function testReflectPreventExtensionsArity() { 399 (function testReflectPreventExtensionsArity() {
368 assertEquals(1, Reflect.preventExtensions.length); 400 assertEquals(1, Reflect.preventExtensions.length);
369 })(); 401 })();
370 402
371 403
372 (function testReflectPreventExtensionsOnNonObject() { 404 (function testReflectPreventExtensionsOnNonObject() {
373 assertThrows(function() { Reflect.preventExtensions(); }, TypeError); 405 assertThrows(function() { Reflect.preventExtensions(); }, TypeError);
374 assertThrows(function() { Reflect.preventExtensions(42); }, TypeError); 406 assertThrows(function() { Reflect.preventExtensions(42); }, TypeError);
375 assertThrows(function() { Reflect.preventExtensions(null); }, TypeError); 407 assertThrows(function() { Reflect.preventExtensions(null); }, TypeError);
376 })(); 408 })();
377 409
378 410
379 // See reflect-prevent-extensions.js for further tests. 411 // See reflect-prevent-extensions.js for further tests.
380 412
381 // TODO(neis): Need proxies to test the situation where 413 // TODO(neis): Need proxies to test the situation where
382 // [[preventExtensions]] returns false. 414 // [[preventExtensions]] returns false.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698