OLD | NEW |
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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 TestPrototype(Map); | 339 TestPrototype(Map); |
340 TestPrototype(WeakMap); | 340 TestPrototype(WeakMap); |
341 TestPrototype(WeakSet); | 341 TestPrototype(WeakSet); |
342 | 342 |
343 | 343 |
344 // Test constructor property of the Set, Map, WeakMap and WeakSet prototype. | 344 // Test constructor property of the Set, Map, WeakMap and WeakSet prototype. |
345 function TestConstructor(C) { | 345 function TestConstructor(C) { |
346 assertFalse(C === Object.prototype.constructor); | 346 assertFalse(C === Object.prototype.constructor); |
347 assertSame(C, C.prototype.constructor); | 347 assertSame(C, C.prototype.constructor); |
348 assertSame(C, (new C).__proto__.constructor); | 348 assertSame(C, (new C).__proto__.constructor); |
349 assertEquals(1, C.length); | 349 assertEquals(0, C.length); |
350 } | 350 } |
351 TestConstructor(Set); | 351 TestConstructor(Set); |
352 TestConstructor(Map); | 352 TestConstructor(Map); |
353 TestConstructor(WeakMap); | 353 TestConstructor(WeakMap); |
354 TestConstructor(WeakSet); | 354 TestConstructor(WeakSet); |
355 | 355 |
356 | 356 |
357 // Test the Set, Map, WeakMap and WeakSet global properties themselves. | 357 // Test the Set, Map, WeakMap and WeakSet global properties themselves. |
358 function TestDescriptor(global, C) { | 358 function TestDescriptor(global, C) { |
359 assertEquals({ | 359 assertEquals({ |
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 assertEquals(adderName + 'iterator', log); | 1467 assertEquals(adderName + 'iterator', log); |
1468 | 1468 |
1469 Object.defineProperty(ctor.prototype, adderName, { | 1469 Object.defineProperty(ctor.prototype, adderName, { |
1470 value: adderFunction | 1470 value: adderFunction |
1471 }); | 1471 }); |
1472 } | 1472 } |
1473 TestConstructorOrderOfAdderIterator(Map, 'set'); | 1473 TestConstructorOrderOfAdderIterator(Map, 'set'); |
1474 TestConstructorOrderOfAdderIterator(Set, 'add'); | 1474 TestConstructorOrderOfAdderIterator(Set, 'add'); |
1475 TestConstructorOrderOfAdderIterator(WeakMap, 'set'); | 1475 TestConstructorOrderOfAdderIterator(WeakMap, 'set'); |
1476 TestConstructorOrderOfAdderIterator(WeakSet, 'add'); | 1476 TestConstructorOrderOfAdderIterator(WeakSet, 'add'); |
OLD | NEW |