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

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

Issue 1106713002: Revert of [es6] Map/Set size getter should have "get size" name (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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/built-in-accessor-names.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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 436
437 437
438 // Set and Map size getters 438 // Set and Map size getters
439 var setSizeDescriptor = Object.getOwnPropertyDescriptor(Set.prototype, 'size'); 439 var setSizeDescriptor = Object.getOwnPropertyDescriptor(Set.prototype, 'size');
440 assertEquals(undefined, setSizeDescriptor.value); 440 assertEquals(undefined, setSizeDescriptor.value);
441 assertEquals(undefined, setSizeDescriptor.set); 441 assertEquals(undefined, setSizeDescriptor.set);
442 assertTrue(setSizeDescriptor.get instanceof Function); 442 assertTrue(setSizeDescriptor.get instanceof Function);
443 assertEquals(undefined, setSizeDescriptor.get.prototype); 443 assertEquals(undefined, setSizeDescriptor.get.prototype);
444 assertFalse(setSizeDescriptor.enumerable); 444 assertFalse(setSizeDescriptor.enumerable);
445 assertTrue(setSizeDescriptor.configurable); 445 assertTrue(setSizeDescriptor.configurable);
446 assertEquals('get size', setSizeDescriptor.get.name);
447 446
448 var s = new Set(); 447 var s = new Set();
449 assertFalse(s.hasOwnProperty('size')); 448 assertFalse(s.hasOwnProperty('size'));
450 for (var i = 0; i < 10; i++) { 449 for (var i = 0; i < 10; i++) {
451 assertEquals(i, s.size); 450 assertEquals(i, s.size);
452 s.add(i); 451 s.add(i);
453 } 452 }
454 for (var i = 9; i >= 0; i--) { 453 for (var i = 9; i >= 0; i--) {
455 s.delete(i); 454 s.delete(i);
456 assertEquals(i, s.size); 455 assertEquals(i, s.size);
457 } 456 }
458 457
459 458
460 var mapSizeDescriptor = Object.getOwnPropertyDescriptor(Map.prototype, 'size'); 459 var mapSizeDescriptor = Object.getOwnPropertyDescriptor(Map.prototype, 'size');
461 assertEquals(undefined, mapSizeDescriptor.value); 460 assertEquals(undefined, mapSizeDescriptor.value);
462 assertEquals(undefined, mapSizeDescriptor.set); 461 assertEquals(undefined, mapSizeDescriptor.set);
463 assertTrue(mapSizeDescriptor.get instanceof Function); 462 assertTrue(mapSizeDescriptor.get instanceof Function);
464 assertEquals(undefined, mapSizeDescriptor.get.prototype); 463 assertEquals(undefined, mapSizeDescriptor.get.prototype);
465 assertFalse(mapSizeDescriptor.enumerable); 464 assertFalse(mapSizeDescriptor.enumerable);
466 assertTrue(mapSizeDescriptor.configurable); 465 assertTrue(mapSizeDescriptor.configurable);
467 assertEquals('get size', mapSizeDescriptor.get.name);
468 466
469 var m = new Map(); 467 var m = new Map();
470 assertFalse(m.hasOwnProperty('size')); 468 assertFalse(m.hasOwnProperty('size'));
471 for (var i = 0; i < 10; i++) { 469 for (var i = 0; i < 10; i++) {
472 assertEquals(i, m.size); 470 assertEquals(i, m.size);
473 m.set(i, i); 471 m.set(i, i);
474 } 472 }
475 for (var i = 9; i >= 0; i--) { 473 for (var i = 9; i >= 0; i--) {
476 m.delete(i); 474 m.delete(i);
477 assertEquals(i, m.size); 475 assertEquals(i, m.size);
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 assertEquals(adderName + 'iterator', log); 1467 assertEquals(adderName + 'iterator', log);
1470 1468
1471 Object.defineProperty(ctor.prototype, adderName, { 1469 Object.defineProperty(ctor.prototype, adderName, {
1472 value: adderFunction 1470 value: adderFunction
1473 }); 1471 });
1474 } 1472 }
1475 TestConstructorOrderOfAdderIterator(Map, 'set'); 1473 TestConstructorOrderOfAdderIterator(Map, 'set');
1476 TestConstructorOrderOfAdderIterator(Set, 'add'); 1474 TestConstructorOrderOfAdderIterator(Set, 'add');
1477 TestConstructorOrderOfAdderIterator(WeakMap, 'set'); 1475 TestConstructorOrderOfAdderIterator(WeakMap, 'set');
1478 TestConstructorOrderOfAdderIterator(WeakSet, 'add'); 1476 TestConstructorOrderOfAdderIterator(WeakSet, 'add');
OLDNEW
« no previous file with comments | « test/mjsunit/es6/built-in-accessor-names.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698