diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/built-ins/WeakSet/prototype/add/adds-symbol-element.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/WeakSet/prototype/add/adds-symbol-element.js')
-rw-r--r-- | js/src/tests/test262/built-ins/WeakSet/prototype/add/adds-symbol-element.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/WeakSet/prototype/add/adds-symbol-element.js b/js/src/tests/test262/built-ins/WeakSet/prototype/add/adds-symbol-element.js new file mode 100644 index 0000000000..b56ba8ae80 --- /dev/null +++ b/js/src/tests/test262/built-ins/WeakSet/prototype/add/adds-symbol-element.js @@ -0,0 +1,27 @@ +// |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-weakset.prototype.add +description: Adds a Symbol value. +info: | + WeakSet.prototype.add ( _value_ ) + 6. Append _value_ as the last element of _entries_. +features: [Symbol, WeakSet, symbols-as-weakmap-keys] +---*/ + +var s = new WeakSet(); +var foo = Symbol('a description'); +var bar = Symbol('a description'); +var baz = Symbol('a different description'); + +s.add(foo); +s.add(baz); +s.add(Symbol.hasInstance); + +assert(s.has(foo), 'Regular symbol'); +assert(!s.has(bar), "Symbols with the same description don't alias each other"); +assert(s.has(baz), 'Regular symbol with different description'); +assert(s.has(Symbol.hasInstance), 'Well-known symbol'); + +reportCompare(0, 0); |