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

Side by Side Diff: test/mjsunit/es6/symbols.js

Issue 1018923002: Adjust key behaviour for weak collections (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comments Created 5 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 unified diff | Download patch
« no previous file with comments | « test/mjsunit/es6/collections.js ('k') | test/mjsunit/harmony/private.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 for (var i in symbols) { 238 for (var i in symbols) {
239 assertTrue(symbols[i].getThisProto() === Symbol.prototype) 239 assertTrue(symbols[i].getThisProto() === Symbol.prototype)
240 } 240 }
241 } 241 }
242 TestCall() 242 TestCall()
243 243
244 244
245 function TestCollections() { 245 function TestCollections() {
246 var set = new Set 246 var set = new Set
247 var map = new Map 247 var map = new Map
248 var weakmap = new WeakMap
249 for (var i in symbols) { 248 for (var i in symbols) {
250 set.add(symbols[i]) 249 set.add(symbols[i])
251 map.set(symbols[i], i) 250 map.set(symbols[i], i)
252 weakmap.set(symbols[i], i)
253 } 251 }
254 assertEquals(symbols.length, set.size) 252 assertEquals(symbols.length, set.size)
255 assertEquals(symbols.length, map.size) 253 assertEquals(symbols.length, map.size)
256 for (var i in symbols) { 254 for (var i in symbols) {
257 assertTrue(set.has(symbols[i])) 255 assertTrue(set.has(symbols[i]))
258 assertTrue(map.has(symbols[i])) 256 assertTrue(map.has(symbols[i]))
259 assertTrue(weakmap.has(symbols[i]))
260 assertEquals(i, map.get(symbols[i])) 257 assertEquals(i, map.get(symbols[i]))
261 assertEquals(i, weakmap.get(symbols[i]))
262 } 258 }
263 for (var i in symbols) { 259 for (var i in symbols) {
264 assertTrue(set.delete(symbols[i])) 260 assertTrue(set.delete(symbols[i]))
265 assertTrue(map.delete(symbols[i])) 261 assertTrue(map.delete(symbols[i]))
266 assertTrue(weakmap.delete(symbols[i]))
267 } 262 }
268 assertEquals(0, set.size) 263 assertEquals(0, set.size)
269 assertEquals(0, map.size) 264 assertEquals(0, map.size)
270 } 265 }
271 TestCollections() 266 TestCollections()
272 267
273 268
274 269
275 function TestKeySet(obj) { 270 function TestKeySet(obj) {
276 assertTrue(%HasFastProperties(obj)) 271 assertTrue(%HasFastProperties(obj))
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 } 497 }
503 TestRegistry() 498 TestRegistry()
504 499
505 500
506 function TestGetOwnPropertySymbolsOnPrimitives() { 501 function TestGetOwnPropertySymbolsOnPrimitives() {
507 assertEquals(Object.getOwnPropertySymbols(true), []); 502 assertEquals(Object.getOwnPropertySymbols(true), []);
508 assertEquals(Object.getOwnPropertySymbols(5000), []); 503 assertEquals(Object.getOwnPropertySymbols(5000), []);
509 assertEquals(Object.getOwnPropertySymbols("OK"), []); 504 assertEquals(Object.getOwnPropertySymbols("OK"), []);
510 } 505 }
511 TestGetOwnPropertySymbolsOnPrimitives(); 506 TestGetOwnPropertySymbolsOnPrimitives();
OLDNEW
« no previous file with comments | « test/mjsunit/es6/collections.js ('k') | test/mjsunit/harmony/private.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698