diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/WeakMap/prototype/delete/returns-false-when-symbol-key-not-present.js')
-rw-r--r-- | js/src/tests/test262/built-ins/WeakMap/prototype/delete/returns-false-when-symbol-key-not-present.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/delete/returns-false-when-symbol-key-not-present.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/returns-false-when-symbol-key-not-present.js new file mode 100644 index 0000000000..873b481212 --- /dev/null +++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/returns-false-when-symbol-key-not-present.js @@ -0,0 +1,25 @@ +// |reftest| shell-option(--enable-symbols-as-weakmap-keys) skip-if(release_or_beta||!xulRuntime.shell) -- symbols-as-weakmap-keys is not released yet, requires shell-options +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-weakmap.prototype.delete +description: > + Return false if a Symbol key is not in the WeakMap. +info: | + WeakMap.prototype.delete ( _key_ ) + 6. Return *false*. +features: [Symbol, WeakMap, symbols-as-weakmap-keys] +---*/ + +var map = new WeakMap(); +var foo = Symbol('a description'); +var bar = Symbol('a description'); +var baz = Symbol('another description'); + +map.set(foo, 42); + +assert.sameValue(map.delete(baz), false, 'Regular symbol key not present') +assert.sameValue(map.delete(bar), false, "Symbols with the same description don't alias to each other"); +assert.sameValue(map.delete(Symbol.hasInstance), false, 'Well-known symbol key not present'); + +reportCompare(0, 0); |