Index: test/mjsunit/harmony/collections.js |
diff --git a/test/mjsunit/harmony/collections.js b/test/mjsunit/harmony/collections.js |
index d60c59c90712edc3a84b077280d11a8964d12f76..cf18745ae85a30d5f2748838777d156de2799143 100644 |
--- a/test/mjsunit/harmony/collections.js |
+++ b/test/mjsunit/harmony/collections.js |
@@ -377,17 +377,39 @@ for (var i = 9; i >= 0; i--) { |
assertEquals(i, m.size); |
} |
-// Test clear |
-var a = new Set(); |
-s.add(42); |
-assertTrue(s.has(42)); |
-s.clear(); |
-assertFalse(s.has(42)); |
-assertEquals(0, s.size); |
-var m = new Map(); |
-m.set(42, true); |
-assertTrue(m.has(42)); |
-m.clear(); |
-assertFalse(m.has(42)); |
-assertEquals(0, m.size); |
+// Test Set clear |
+(function() { |
+ var s = new Set(); |
+ s.add(42); |
+ assertTrue(s.has(42)); |
+ assertEquals(1, s.size); |
+ s.clear(); |
+ assertFalse(s.has(42)); |
+ assertEquals(0, s.size); |
+})(); |
+ |
+ |
+// Test Map clear |
+(function() { |
+ var m = new Map(); |
+ m.set(42, true); |
+ assertTrue(m.has(42)); |
+ assertEquals(1, m.size); |
+ m.clear(); |
+ assertFalse(m.has(42)); |
+ assertEquals(0, m.size); |
+})(); |
+ |
+ |
+// Test WeakMap clear |
+(function() { |
+ var k = new Object(); |
+ var w = new WeakMap(); |
+ w.set(k, 23); |
+ assertTrue(w.has(k)); |
+ assertEquals(23, w.get(k)); |
+ w.clear(); |
+ assertFalse(w.has(k)); |
+ assertEquals(undefined, w.get(k)); |
+})(); |