blob: f8cc82cdf7e53bb13b14f76d5bd882ba941ac4a4 [file] [log] [blame]
function shouldBe(actual, expected)
{
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
let map = new Map();
for (let i = 0; i < 5; ++i)
map.set(i, i);
for (let i = 0; i < 1e2; ++i) {
let cloned = new Map(map);
shouldBe(cloned.size, map.size);
}
class DerivedMap extends Map {
constructor(map)
{
super(map);
}
set(key, value)
{
// ignore.
}
}
for (let i = 0; i < 1e2; ++i) {
let cloned = new DerivedMap(map);
shouldBe(cloned.size, 0);
}