Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Map/symbol-as-entry-key.js

raw
1 // Copyright (C) 2013 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 es6id: 19.4
5 description: >
6 Symbol as Map key
7 features: [Symbol]
8 ---*/
9 var map = new Map();
10 var sym = Symbol();
11
12 map.set(sym, 1);
13
14 assert.sameValue(map.size, 1, "The value of `map.size` is `1`, after executing `map.set(sym, 1)`");
15 assert.sameValue(map.has(sym), true, "`map.has(sym)` returns `true`");
16 assert.sameValue(map.get(sym), 1, "`map.get(sym)` returns `1`");
17 assert.sameValue(map.delete(sym), true, "`map.delete(sym)` returns `true`");
18 assert.sameValue(map.size, 0, "The value of `map.size` is `0`");