summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/collections/WeakMap-constructor-non-iterable.js
blob: 427818d77508fd98b54c1a110feaa092dd0f0050 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// WeakMap should throw if argument is not iterable object.

load(libdir + "asserts.js");
load(libdir + "iteration.js");

var non_iterable1 = {};
non_iterable1[Symbol.iterator] = {};
assertThrowsInstanceOf(() => new WeakMap(non_iterable1), TypeError);

var non_iterable2 = {};
non_iterable2[Symbol.iterator] = function() {
};
assertThrowsInstanceOf(() => new WeakMap(non_iterable2), TypeError);