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

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

Issue 108083005: ES6: Add Object.getOwnPropertySymbols (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: reitveld error Created 7 years 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
« src/v8natives.js ('K') | « src/v8natives.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/symbols.js
diff --git a/test/mjsunit/harmony/symbols.js b/test/mjsunit/harmony/symbols.js
index 3fcd06dfdca985fcd81abd8630cb8ededa8fe0d7..812ed196a1a06ff7caef04874de0227146a4a271 100644
--- a/test/mjsunit/harmony/symbols.js
+++ b/test/mjsunit/harmony/symbols.js
@@ -298,6 +298,15 @@ function TestKeyNames(obj) {
}
+function TestKeySymbols(obj) {
rossberg 2013/12/10 10:39:53 Let's call this TestGetOwnPropertySymbols
arv (Not doing code reviews) 2013/12/11 00:16:26 Done.
+ var syms = Object.getOwnPropertySymbols(obj)
+ assertEquals(syms.length, symbols.length)
+ for (var i in syms) {
+ assertEquals("symbol", typeof syms[i])
rossberg 2013/12/10 10:39:53 Also assert that insertion order is maintained (wh
arv (Not doing code reviews) 2013/12/11 00:16:26 You sent me off on goose chase there. I finally fi
rossberg 2013/12/12 15:37:59 Ah, sorry about that. I should have known.
+ }
+}
+
+
function TestKeyDescriptor(obj) {
for (var i in symbols) {
var desc = Object.getOwnPropertyDescriptor(obj, symbols[i]);
@@ -331,6 +340,7 @@ for (var i in objs) {
TestKeyHas(obj)
TestKeyEnum(obj)
TestKeyNames(obj)
+ TestKeySymbols(obj)
TestKeyDescriptor(obj)
TestKeyDelete(obj)
}
@@ -350,3 +360,12 @@ function TestCachedKeyAfterScavenge() {
}
}
TestCachedKeyAfterScavenge();
+
+
+function TestGetOwnPropertySymbolsWithPrivateSymbols() {
rossberg 2013/12/10 10:39:53 Nit: Move this next to the other test.
arv (Not doing code reviews) 2013/12/11 00:16:26 I kept it here because this test does not take an
+ var privateSymbol = %CreatePrivateSymbol("private")
+ var obj = {}
rossberg 2013/12/10 10:39:53 Hm, the private symbol is never added to obj. ;)
arv (Not doing code reviews) 2013/12/11 00:16:26 Doh!
+ var syms = Object.getOwnPropertySymbols(obj)
+ assertEquals(syms.length, 0)
+}
+TestGetOwnPropertySymbolsWithPrivateSymbols()
« src/v8natives.js ('K') | « src/v8natives.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698