js/src/jit-test/tests/collections/Map-constructor-5.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:9be8e41edf2b
1 // Map(arr) throws if arr contains holes (or undefined values).
2
3 load(libdir + "asserts.js");
4 assertThrowsInstanceOf(function () { Map([undefined]); }, TypeError);
5 assertThrowsInstanceOf(function () { Map([null]); }, TypeError);
6 assertThrowsInstanceOf(function () { Map([[0, 0], [1, 1], , [3, 3]]); }, TypeError);
7 assertThrowsInstanceOf(function () { Map([[0, 0], [1, 1], ,]); }, TypeError);
8
9 // Map(iterable) throws if iterable doesn't have array-like objects
10
11 assertThrowsInstanceOf(function () { Map([1, 2, 3]); }, TypeError);
12 assertThrowsInstanceOf(function () {
13 let s = new Set([1, 2, "abc"]);
14 new Map(s);
15 }, TypeError);

mercurial