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

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

Issue 12456004: ES6 symbols: enable symbols as weak map keys (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 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 | « src/runtime.cc ('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 b35d950981ba1f119cbc71a88a8eb21eca9f9a38..b0aebd345ba34a298be3db07d837cf0ac4b1d4b4 100644
--- a/test/mjsunit/harmony/symbols.js
+++ b/test/mjsunit/harmony/symbols.js
@@ -114,17 +114,33 @@ function TestSet() {
TestSet()
-function TestMap() {
+function TestCollections() {
+ var set = new Set
var map = new Map
+ var weakmap = new WeakMap
for (var i in symbols) {
+ set.add(symbols[i])
map.set(symbols[i], i)
+ weakmap.set(symbols[i], i)
}
+ assertEquals(symbols.length, set.size)
+ assertEquals(symbols.length, map.size)
for (var i in symbols) {
+ assertTrue(set.has(symbols[i]))
assertTrue(map.has(symbols[i]))
+ assertTrue(weakmap.has(symbols[i]))
assertEquals(i, map.get(symbols[i]))
+ assertEquals(i, weakmap.get(symbols[i]))
}
+ for (var i in symbols) {
+ assertTrue(set.delete(symbols[i]))
+ assertTrue(map.delete(symbols[i]))
+ assertTrue(weakmap.delete(symbols[i]))
+ }
+ assertEquals(0, set.size)
+ assertEquals(0, map.size)
}
-TestMap()
+TestCollections()
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698