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

Unified Diff: test/mjsunit/harmony/reflect-get-prototype-of.js

Issue 1416433003: [es6] Partially implement Reflect.getPrototypeOf. (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
« no previous file with comments | « test/mjsunit/harmony/reflect.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 = [
« no previous file with comments | « test/mjsunit/harmony/reflect.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698