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

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

Issue 12432005: ES6 symbols: refine test for getOwnPropertyNames (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comment Created 7 years, 9 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 | « no previous file | 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 13a1010879d25a521da1a17faadef3a0704c3c7d..cdc63628ae9d219bde3ecb3a271d1396cbbf345a 100644
--- a/test/mjsunit/harmony/symbols.js
+++ b/test/mjsunit/harmony/symbols.js
@@ -184,9 +184,25 @@ function TestKeyEnum(obj) {
}
-function TestKeyKeys(obj) {
+function TestKeyNames(obj) {
assertEquals(0, Object.keys(obj).length)
- assertTrue(symbols.length <= Object.getOwnPropertyNames(obj).length)
+
+ var names = Object.getOwnPropertyNames(obj)
+ assertTrue(symbols.length <= names.length)
+ // TODO(rossberg): once we have iterators, the following would be:
+ // var expected = new Set(symbols)
+ var expected = new Set
+ for (var i = 0; i < symbols.length; ++i) expected.add(symbols[i])
+ for (var i = 0; i < names.length; ++i) {
+ var name = names[i]
+ var asString = String(name)
+ if (asString !== name) {
+ assertEquals("[object Symbol]", asString)
+ assertTrue(expected.has(name))
+ expected.delete(name)
+ }
+ }
+ assertEquals(0, expected.size)
}
@@ -222,7 +238,7 @@ for (var i in objs) {
TestKeyGet(obj)
TestKeyHas(obj)
TestKeyEnum(obj)
- TestKeyKeys(obj)
+ TestKeyNames(obj)
TestKeyDescriptor(obj)
TestKeyDelete(obj)
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698