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

Side by Side Diff: test/mjsunit/harmony/collections.js

Issue 11409002: ES6: Add support for Set and Map clear method (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
« src/collection.js ('K') | « src/collection.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 var m = new Map(); 348 var m = new Map();
349 assertFalse(m.hasOwnProperty('size')); 349 assertFalse(m.hasOwnProperty('size'));
350 for (var i = 0; i < 10; i++) { 350 for (var i = 0; i < 10; i++) {
351 assertEquals(i, m.size); 351 assertEquals(i, m.size);
352 m.set(i, i); 352 m.set(i, i);
353 } 353 }
354 for (var i = 9; i >= 0; i--) { 354 for (var i = 9; i >= 0; i--) {
355 m.delete(i); 355 m.delete(i);
356 assertEquals(i, m.size); 356 assertEquals(i, m.size);
357 } 357 }
358
359 // Test clear
360 var a = new Set();
361 s.add(42);
362 assertTrue(s.has(42));
363 s.clear();
364 assertFalse(s.has(42));
365 assertEquals(0, s.size);
366
367 var m = new Map();
368 m.set(42, true);
369 assertTrue(m.has(42));
370 m.clear();
371 assertFalse(m.has(42));
372 assertEquals(0, m.size);
OLDNEW
« src/collection.js ('K') | « src/collection.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698