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

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

Issue 1093183006: [es6] Map/Set size getter should have "get size" name (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Use IS_UNDEFINED instead 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);
446 447
447 var s = new Set(); 448 var s = new Set();
448 assertFalse(s.hasOwnProperty('size')); 449 assertFalse(s.hasOwnProperty('size'));
449 for (var i = 0; i < 10; i++) { 450 for (var i = 0; i < 10; i++) {
450 assertEquals(i, s.size); 451 assertEquals(i, s.size);
451 s.add(i); 452 s.add(i);
452 } 453 }
453 for (var i = 9; i >= 0; i--) { 454 for (var i = 9; i >= 0; i--) {
454 s.delete(i); 455 s.delete(i);
455 assertEquals(i, s.size); 456 assertEquals(i, s.size);
456 } 457 }
457 458
458 459
459 var mapSizeDescriptor = Object.getOwnPropertyDescriptor(Map.prototype, 'size'); 460 var mapSizeDescriptor = Object.getOwnPropertyDescriptor(Map.prototype, 'size');
460 assertEquals(undefined, mapSizeDescriptor.value); 461 assertEquals(undefined, mapSizeDescriptor.value);
461 assertEquals(undefined, mapSizeDescriptor.set); 462 assertEquals(undefined, mapSizeDescriptor.set);
462 assertTrue(mapSizeDescriptor.get instanceof Function); 463 assertTrue(mapSizeDescriptor.get instanceof Function);
463 assertEquals(undefined, mapSizeDescriptor.get.prototype); 464 assertEquals(undefined, mapSizeDescriptor.get.prototype);
464 assertFalse(mapSizeDescriptor.enumerable); 465 assertFalse(mapSizeDescriptor.enumerable);
465 assertTrue(mapSizeDescriptor.configurable); 466 assertTrue(mapSizeDescriptor.configurable);
467 assertEquals('get size', mapSizeDescriptor.get.name);
466 468
467 var m = new Map(); 469 var m = new Map();
468 assertFalse(m.hasOwnProperty('size')); 470 assertFalse(m.hasOwnProperty('size'));
469 for (var i = 0; i < 10; i++) { 471 for (var i = 0; i < 10; i++) {
470 assertEquals(i, m.size); 472 assertEquals(i, m.size);
471 m.set(i, i); 473 m.set(i, i);
472 } 474 }
473 for (var i = 9; i >= 0; i--) { 475 for (var i = 9; i >= 0; i--) {
474 m.delete(i); 476 m.delete(i);
475 assertEquals(i, m.size); 477 assertEquals(i, m.size);
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 assertEquals(adderName + 'iterator', log); 1469 assertEquals(adderName + 'iterator', log);
1468 1470
1469 Object.defineProperty(ctor.prototype, adderName, { 1471 Object.defineProperty(ctor.prototype, adderName, {
1470 value: adderFunction 1472 value: adderFunction
1471 }); 1473 });
1472 } 1474 }
1473 TestConstructorOrderOfAdderIterator(Map, 'set'); 1475 TestConstructorOrderOfAdderIterator(Map, 'set');
1474 TestConstructorOrderOfAdderIterator(Set, 'add'); 1476 TestConstructorOrderOfAdderIterator(Set, 'add');
1475 TestConstructorOrderOfAdderIterator(WeakMap, 'set'); 1477 TestConstructorOrderOfAdderIterator(WeakMap, 'set');
1476 TestConstructorOrderOfAdderIterator(WeakSet, 'add'); 1478 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