Index: test/mjsunit/harmony/reflect-get-prototype-of.js |
diff --git a/test/mjsunit/get-prototype-of.js b/test/mjsunit/harmony/reflect-get-prototype-of.js |
similarity index 74% |
copy from test/mjsunit/get-prototype-of.js |
copy to test/mjsunit/harmony/reflect-get-prototype-of.js |
index 47edcb0a771123f03dbd275ccf20a3872f2d58bc..1ce86347df50d161ffe8ba54cd75e0a076790af8 100644 |
--- a/test/mjsunit/get-prototype-of.js |
+++ b/test/mjsunit/harmony/reflect-get-prototype-of.js |
@@ -1,4 +1,4 @@ |
-// Copyright 2010 the V8 project authors. All rights reserved. |
+// Copyright 2010-2015 the V8 project authors. All rights reserved. |
// Redistribution and use in source and binary forms, with or without |
// modification, are permitted provided that the following conditions are |
// met: |
@@ -25,18 +25,25 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+// Tests the Reflect.getPrototypeOf - ES6 26.1.8. |
+// This is adapted from mjsunit/get-prototype-of.js. |
+ |
+// Flags: --harmony-reflect |
+ |
+ |
+ |
function assertPrototypeOf(func, expected) { |
- assertEquals(expected, Object.getPrototypeOf(func)); |
+ assertEquals(expected, Reflect.getPrototypeOf(func)); |
} |
assertThrows(function() { |
- Object.getPrototypeOf(undefined); |
+ Reflect.getPrototypeOf(undefined); |
}, TypeError); |
assertThrows(function() { |
- Object.getPrototypeOf(null); |
+ Reflect.getPrototypeOf(null); |
}, TypeError); |
@@ -52,11 +59,27 @@ assertPrototypeOf({x: 5, __proto__: null}, null); |
assertPrototypeOf([1, 2], Array.prototype); |
-assertPrototypeOf(1, Number.prototype); |
-assertPrototypeOf(true, Boolean.prototype); |
-assertPrototypeOf(false, Boolean.prototype); |
-assertPrototypeOf('str', String.prototype); |
-assertPrototypeOf(Symbol(), Symbol.prototype); |
+assertThrows(function () { |
+ Reflect.getPrototypeOf(1); |
+}, TypeError); |
+assertThrows(function () { |
+ Reflect.getPrototypeOf(true); |
+}, TypeError); |
+assertThrows(function () { |
+ Reflect.getPrototypeOf(false); |
+}, TypeError); |
+assertThrows(function () { |
+ Reflect.getPrototypeOf('str'); |
+}, TypeError); |
+assertThrows(function () { |
+ Reflect.getPrototypeOf(Symbol()); |
+}, TypeError); |
+ |
+assertPrototypeOf(Object(1), Number.prototype); |
+assertPrototypeOf(Object(true), Boolean.prototype); |
+assertPrototypeOf(Object(false), Boolean.prototype); |
+assertPrototypeOf(Object('str'), String.prototype); |
+assertPrototypeOf(Object(Symbol()), Symbol.prototype); |
var errorFunctions = [ |