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

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

Issue 451033003: WeakMap/WeakSet: Add test for non object keys (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 return this; 1134 return this;
1135 }; 1135 };
1136 assertThrows(function() { 1136 assertThrows(function() {
1137 new ctor(iterator); 1137 new ctor(iterator);
1138 }, TypeError); 1138 }, TypeError);
1139 } 1139 }
1140 TestSetConstructorNextNotAnObject(Set); 1140 TestSetConstructorNextNotAnObject(Set);
1141 TestSetConstructorNextNotAnObject(WeakSet); 1141 TestSetConstructorNextNotAnObject(WeakSet);
1142 1142
1143 1143
1144 (function TestWeakSetConstructorNonObjectKeys() {
1145 assertThrows(function() {
1146 new WeakSet([1]);
1147 }, TypeError);
1148 })();
1149
1150
1144 function TestMapConstructor(ctor) { 1151 function TestMapConstructor(ctor) {
1145 var m = new ctor(null); 1152 var m = new ctor(null);
1146 assertSize(0, m); 1153 assertSize(0, m);
1147 1154
1148 m = new ctor(undefined); 1155 m = new ctor(undefined);
1149 assertSize(0, m); 1156 assertSize(0, m);
1150 1157
1151 // No @@iterator 1158 // No @@iterator
1152 assertThrows(function() { 1159 assertThrows(function() {
1153 new ctor({}); 1160 new ctor({});
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 TestMapConstructorNextNotAnObject(WeakMap); 1286 TestMapConstructorNextNotAnObject(WeakMap);
1280 1287
1281 1288
1282 function TestMapConstructorIteratorNotObjectValues(ctor) { 1289 function TestMapConstructorIteratorNotObjectValues(ctor) {
1283 assertThrows(function() { 1290 assertThrows(function() {
1284 new ctor(oneAndTwo.values()); 1291 new ctor(oneAndTwo.values());
1285 }, TypeError); 1292 }, TypeError);
1286 } 1293 }
1287 TestMapConstructorIteratorNotObjectValues(Map); 1294 TestMapConstructorIteratorNotObjectValues(Map);
1288 TestMapConstructorIteratorNotObjectValues(WeakMap); 1295 TestMapConstructorIteratorNotObjectValues(WeakMap);
1296
1297
1298 (function TestWeakMapConstructorNonObjectKeys() {
1299 assertThrows(function() {
1300 new WeakMap([[1, 2]])
1301 }, TypeError);
1302 })();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698