summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Map/prototype/size/returns-count-of-present-values-by-insertion.js
blob: f8dcb3497bb2655aa34eb6eb2f8e153fedda8dbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-get-map.prototype.size
description: >
  Returns count of present values inserted with set.
info: |
  get Map.prototype.size

  5. Let count be 0.
  6. For each Record {[[key]], [[value]]} p that is an element of entries
    a. If p.[[key]] is not empty, set count to count+1.
features: [Symbol]
---*/

var map = new Map();

map.set(0, undefined);
map.set(undefined, undefined);
map.set(false, undefined);
map.set(NaN, undefined);
map.set(null, undefined);
map.set('', undefined);
map.set(Symbol(), undefined);

assert.sameValue(map.size, 7, 'The value of `map.size` is `7`');

reportCompare(0, 0);