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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/collections/Map-constructor-5.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,15 @@
     1.4 +// Map(arr) throws if arr contains holes (or undefined values).
     1.5 +
     1.6 +load(libdir + "asserts.js");
     1.7 +assertThrowsInstanceOf(function () { Map([undefined]); }, TypeError);
     1.8 +assertThrowsInstanceOf(function () { Map([null]); }, TypeError);
     1.9 +assertThrowsInstanceOf(function () { Map([[0, 0], [1, 1], , [3, 3]]); }, TypeError);
    1.10 +assertThrowsInstanceOf(function () { Map([[0, 0], [1, 1], ,]); }, TypeError);
    1.11 +
    1.12 +// Map(iterable) throws if iterable doesn't have array-like objects
    1.13 +
    1.14 +assertThrowsInstanceOf(function () { Map([1, 2, 3]); }, TypeError);
    1.15 +assertThrowsInstanceOf(function () {
    1.16 +	let s = new Set([1, 2, "abc"]);
    1.17 +	new Map(s);
    1.18 +}, TypeError);

mercurial