diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-false-when-key-cannot-be-held-weakly.js')
-rw-r--r-- | js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-false-when-key-cannot-be-held-weakly.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-false-when-key-cannot-be-held-weakly.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-false-when-key-cannot-be-held-weakly.js new file mode 100644 index 0000000000..c570a66518 --- /dev/null +++ b/js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-false-when-key-cannot-be-held-weakly.js @@ -0,0 +1,22 @@ +// 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-weakmap.prototype.has +description: > + Returns false if the key cannot be held weakly +info: | + WeakMap.prototype.has ( _key_ ) + 4. If CanBeHeldWeakly(_key_) is *false*, return *false*. +features: [Symbol, WeakMap] +---*/ + +var map = new WeakMap(); + +assert.sameValue(map.has(1), false); +assert.sameValue(map.has(''), false); +assert.sameValue(map.has(null), false); +assert.sameValue(map.has(undefined), false); +assert.sameValue(map.has(true), false); +assert.sameValue(map.has(Symbol.for('registered symbol')), false, 'Registered symbol not allowed as key'); + +reportCompare(0, 0); |