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

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: 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 assertThrows(function() { Reflect.enumerate(42); }, TypeError); 319 assertThrows(function() { Reflect.enumerate(42); }, TypeError);
320 assertThrows(function() { Reflect.enumerate(null); }, TypeError); 320 assertThrows(function() { Reflect.enumerate(null); }, TypeError);
321 })(); 321 })();
322 322
323 323
324 // See reflect-enumerate*.js for further tests. 324 // See reflect-enumerate*.js for further tests.
325 325
326 326
327 327
328 //////////////////////////////////////////////////////////////////////////////// 328 ////////////////////////////////////////////////////////////////////////////////
329 // Reflect.getOwnPropertyDescriptor
330
331
332 (function testReflectGetOwnPropertyDescriptorArity() {
333 assertEquals(2, Reflect.getOwnPropertyDescriptor.length);
334 })();
335
336
337 (function testReflectGetOwnPropertyDescriptorOnNonObject() {
338 assertThrows(function() { Reflect.getOwnPropertyDescriptor(); }, TypeError);
339 assertThrows(function() { Reflect.getOwnPropertyDescriptor(42); },
340 TypeError);
341 assertThrows(function() { Reflect.getOwnPropertyDescriptor(null); },
342 TypeError);
343 })();
344
345
346 (function testReflectGetOwnPropertyDescriptorKeyConversion() {
347 var tgt = {bla: 42};
Jakob Kummerow 2015/10/26 13:58:26 nit: s/tgt/target/
Jakob Kummerow 2015/10/29 18:06:02 Forgot this?
neis 2015/10/30 08:41:30 Done.
348 var a = { [Symbol.toPrimitive]: function() { return "bla" } };
349 var b = { [Symbol.toPrimitive]: function() { throw "gaga" } };
350 assertEquals(42, Reflect.getOwnPropertyDescriptor(tgt, a).value);
351 assertThrows(function() { Reflect.getOwnPropertyDescriptor(tgt, b); },
352 "gaga");
353 })();
354
355
356 // See reflect-get-own-property-descriptor.js for further tests.
Jakob Kummerow 2015/10/26 13:58:26 Any particular reason why the tests are split acro
357
358
359
360 ////////////////////////////////////////////////////////////////////////////////
329 // Reflect.preventExtensions 361 // Reflect.preventExtensions
330 362
331 363
332 (function testReflectPreventExtensionsArity() { 364 (function testReflectPreventExtensionsArity() {
333 assertEquals(1, Reflect.preventExtensions.length); 365 assertEquals(1, Reflect.preventExtensions.length);
334 })(); 366 })();
335 367
336 368
337 (function testReflectPreventExtensionsOnNonObject() { 369 (function testReflectPreventExtensionsOnNonObject() {
338 assertThrows(function() { Reflect.preventExtensions(); }, TypeError); 370 assertThrows(function() { Reflect.preventExtensions(); }, TypeError);
339 assertThrows(function() { Reflect.preventExtensions(42); }, TypeError); 371 assertThrows(function() { Reflect.preventExtensions(42); }, TypeError);
340 assertThrows(function() { Reflect.preventExtensions(null); }, TypeError); 372 assertThrows(function() { Reflect.preventExtensions(null); }, TypeError);
341 })(); 373 })();
342 374
343 375
344 // See reflect-prevent-extensions.js for further tests. 376 // See reflect-prevent-extensions.js for further tests.
345 377
346 // TODO(neis): Need proxies to test the situation where 378 // TODO(neis): Need proxies to test the situation where
347 // [[preventExtensions]] returns false. 379 // [[preventExtensions]] returns false.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698