diff -r 000000000000 -r 6474c204b198 js/src/jit-test/tests/collections/Map-constructor-5.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/src/jit-test/tests/collections/Map-constructor-5.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,15 @@ +// Map(arr) throws if arr contains holes (or undefined values). + +load(libdir + "asserts.js"); +assertThrowsInstanceOf(function () { Map([undefined]); }, TypeError); +assertThrowsInstanceOf(function () { Map([null]); }, TypeError); +assertThrowsInstanceOf(function () { Map([[0, 0], [1, 1], , [3, 3]]); }, TypeError); +assertThrowsInstanceOf(function () { Map([[0, 0], [1, 1], ,]); }, TypeError); + +// Map(iterable) throws if iterable doesn't have array-like objects + +assertThrowsInstanceOf(function () { Map([1, 2, 3]); }, TypeError); +assertThrowsInstanceOf(function () { + let s = new Set([1, 2, "abc"]); + new Map(s); +}, TypeError);