summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/collections/WeakMap-constructor-nonnull.js
blob: 5cae35a38f2557e7fdb8b1c121a11e31ed8197cf (plain)
1
2
3
4
5
6
7
8
9
10
11
// WeakMap constructor should throw when key is nonnull.

load(libdir + "asserts.js");

var v1 = 42;

var primitive = 10;
assertThrowsInstanceOf(() => new WeakMap([[primitive, v1]]), TypeError);

var empty_array = [];
assertThrowsInstanceOf(() => new WeakMap([empty_array]), TypeError);