summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/collections/Map-set-size.js
blob: 3c4a13c85e9664ac40dea752b96dbea2d5ca4554 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// map.set(k, v) increments the map size iff map didn't already have an entry for k.

var m = new Map();
m.set('a', 0);
assertEq(m.size, 1);
m.set('a', 0);
assertEq(m.size, 1);
m.set('a', undefined);
assertEq(m.size, 1);

m.set('b', 2);
assertEq(m.size, 2);
m.set('a', 1);
assertEq(m.size, 2);