]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/map-constructor.js
1 // Map constructor behaviors.
3 if (typeof Map
!== 'function')
4 throw "Error: bad value" + typeof Map
;
6 function testCallTypeError(item
) {
14 throw "Error: error not thrown";
15 if (String(error
) !== "TypeError: Map cannot be called as a function")
16 throw "Error: bad error " + String(error
);
82 for (var pair
of pass
) {
83 var map
= new Map(pair
[0]);
84 if (map
.size
!== pair
[1])
85 throw "Error: bad map size " + map
.size
;
86 testCallTypeError(pair
[0]);
89 function testTypeError(item
) {
92 var map
= new Map(item
);
97 throw "Error: error not thrown";
98 if (String(error
) !== "TypeError: Type error")
99 throw "Error: bad error " + String(error
);
104 Symbol("Cappuccino"),
110 Object(Symbol("Matcha")),
114 for (var item
of nonIterable
) {
116 testCallTypeError(item
);
119 var notContainNextItem
= [
126 new Set([0,1,2,3,4]),
130 for (var item
of notContainNextItem
) {
132 testCallTypeError(item
);