Debian Codegraph @

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

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