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

Unified 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, 2 months 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 side-by-side diff with in-line comments
Download patch
Index: test/mjsunit/harmony/reflect.js
diff --git a/test/mjsunit/harmony/reflect.js b/test/mjsunit/harmony/reflect.js
index 73d0115db916f3d7041ae3333d7dc9f059e09220..c169e012454ec515d29289d37e840ff66553d6b9 100644
--- a/test/mjsunit/harmony/reflect.js
+++ b/test/mjsunit/harmony/reflect.js
@@ -326,6 +326,38 @@ function prepare(tgt) {
////////////////////////////////////////////////////////////////////////////////
+// Reflect.getOwnPropertyDescriptor
+
+
+(function testReflectGetOwnPropertyDescriptorArity() {
+ assertEquals(2, Reflect.getOwnPropertyDescriptor.length);
+})();
+
+
+(function testReflectGetOwnPropertyDescriptorOnNonObject() {
+ assertThrows(function() { Reflect.getOwnPropertyDescriptor(); }, TypeError);
+ assertThrows(function() { Reflect.getOwnPropertyDescriptor(42); },
+ TypeError);
+ assertThrows(function() { Reflect.getOwnPropertyDescriptor(null); },
+ TypeError);
+})();
+
+
+(function testReflectGetOwnPropertyDescriptorKeyConversion() {
+ 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.
+ var a = { [Symbol.toPrimitive]: function() { return "bla" } };
+ var b = { [Symbol.toPrimitive]: function() { throw "gaga" } };
+ assertEquals(42, Reflect.getOwnPropertyDescriptor(tgt, a).value);
+ assertThrows(function() { Reflect.getOwnPropertyDescriptor(tgt, b); },
+ "gaga");
+})();
+
+
+// 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
+
+
+
+////////////////////////////////////////////////////////////////////////////////
// Reflect.preventExtensions

Powered by Google App Engine
This is Rietveld 408576698