Index: test/mjsunit/harmony/reflect.js |
diff --git a/test/mjsunit/harmony/reflect.js b/test/mjsunit/harmony/reflect.js |
index 73d0115db916f3d7041ae3333d7dc9f059e09220..c410cf903258cec7b8fd529f3cdf46b6fb7e790a 100644 |
--- a/test/mjsunit/harmony/reflect.js |
+++ b/test/mjsunit/harmony/reflect.js |
@@ -177,6 +177,41 @@ function prepare(tgt) { |
//////////////////////////////////////////////////////////////////////////////// |
+// Reflect.defineProperty |
+ |
+ |
+(function testReflectDefinePropertyArity() { |
+ assertEquals(3, Reflect.defineProperty.length); |
+})(); |
+ |
+ |
+(function testReflectDefinePropertyOnNonObject() { |
+ assertThrows(function() { Reflect.defineProperty(); }, TypeError); |
+ assertThrows(function() { Reflect.defineProperty(42, "bla"); }, TypeError); |
+ assertThrows(function() { Reflect.defineProperty(null, "bla"); }, TypeError); |
+ assertThrows(function() { Reflect.defineProperty({}, "bla"); }, TypeError); |
+ assertThrows(function() { Reflect.defineProperty({}, "bla", 42); }, |
+ TypeError); |
+ assertThrows(function() { Reflect.defineProperty({}, "bla", null); }, |
+ TypeError); |
+})(); |
+ |
+ |
+(function testReflectDefinePropertyKeyConversion() { |
+ var tgt = {}; |
+ var a = { [Symbol.toPrimitive]: function() { return "bla" } }; |
+ var b = { [Symbol.toPrimitive]: function() { throw "gaga" } }; |
+ assertTrue(Reflect.defineProperty(tgt, a, {value: 42})); |
+ assertEquals(tgt.bla, 42); |
+ assertThrows(function() { Reflect.defineProperty(tgt, b); }, "gaga"); |
+})(); |
+ |
+ |
+// See reflect-define-property.js for further tests. |
+ |
+ |
+ |
+//////////////////////////////////////////////////////////////////////////////// |
// Reflect.deleteProperty |
@@ -261,12 +296,12 @@ function prepare(tgt) { |
(function testReflectSetPrototypeOfOnNonObject() { |
assertThrows(function() { Reflect.setPrototypeOf(undefined, {}); }, |
- TypeError); |
+ TypeError); |
assertThrows(function() { Reflect.setPrototypeOf(42, {}); }, TypeError); |
assertThrows(function() { Reflect.setPrototypeOf(null, {}); }, TypeError); |
assertThrows(function() { Reflect.setPrototypeOf({}, undefined); }, |
- TypeError); |
+ TypeError); |
assertThrows(function() { Reflect.setPrototypeOf({}, 42); }, TypeError); |
assertTrue(Reflect.setPrototypeOf({}, null)); |
})(); |