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

Unified Diff: test/mjsunit/harmony/reflect.js

Issue 1405243006: [es6] Partially implement Reflect.ownKeys. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Reland 1405243006: [es6] Partially implement Reflect.ownKeys. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/harmony/reflect-own-keys.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/reflect.js
diff --git a/test/mjsunit/harmony/reflect.js b/test/mjsunit/harmony/reflect.js
index a3d44b891656d94ee55ea5c334ec2c782c0ab72b..4872a51fba309b7725ebb283ca3a74e5710fb1da 100644
--- a/test/mjsunit/harmony/reflect.js
+++ b/test/mjsunit/harmony/reflect.js
@@ -540,6 +540,39 @@ function prepare(target) {
////////////////////////////////////////////////////////////////////////////////
+// Reflect.ownKeys
+
+
+(function testReflectOwnKeysArity() {
+ assertEquals(1, Reflect.ownKeys.length);
+})();
+
+
+(function testReflectOwnKeysOnNonObject() {
+ assertThrows(function() { Reflect.ownKeys(); }, TypeError);
+ assertThrows(function() { Reflect.ownKeys(42); }, TypeError);
+ assertThrows(function() { Reflect.ownKeys(null); }, TypeError);
+})();
+
+
+(function testReflectOwnKeysOnObject(){
+ assertEquals(["z", "y", "x"], Reflect.ownKeys({z: 3, y: 2, x: 1}));
+ assertEquals(["length"], Reflect.ownKeys([]));
+
+ var s1 = Symbol("foo");
+ var s2 = Symbol("bar");
+ var obj = { [s1]: 0, "bla": 0, 42: 0, "0": 0,
+ [s2]: 0, "-1": 0, "88": 0, "aaa": 0 };
+ assertEquals(["0", "42", "88", "bla", "-1", "aaa", s1, s2],
+ Reflect.ownKeys(obj));
+})();
+
+
+// See reflect-own-keys.js for further tests.
+
+
+
+////////////////////////////////////////////////////////////////////////////////
// Reflect.preventExtensions
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/harmony/reflect-own-keys.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698