summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/collections/Map-delete.js
blob: d200eb873f4d6af8b9fe63108591b52f1e6ea988 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Map.prototype.delete works whether the key is present or not.

var m = new Map;
var key = {};

// when the map is new
assertEq(m.delete(key), false);
assertEq(m.has(key), false);

// when the key is present
assertEq(m.set(key, 'x'), m);
assertEq(m.delete(key), true);
assertEq(m.has(key), false);
assertEq(m.get(key), undefined);

// when the key has already been deleted
assertEq(m.delete(key), false);
assertEq(m.has(key), false);