summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/WeakSet/prototype/has/returns-true-when-symbol-value-present.js
blob: aeb65b532b5f82e531958547c7ce316a651248cc (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
// |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.has
description: >
  Returns true when a Symbol value is present in the WeakSet entries list.
info: |
  WeakSet.prototype.has ( _value_ )
  5. For each element _e_ of _entries_, do
    a. If _e_ is not ~empty~ and SameValue(_e_, _value_) is *true*, return *true*.
features: [Symbol, WeakSet, symbols-as-weakmap-keys]
---*/

var foo = Symbol('a description');
var s = new WeakSet();

s.add(foo);
assert.sameValue(s.has(foo), true, 'Regular symbol as value');

s.add(Symbol.hasInstance);
assert.sameValue(s.has(Symbol.hasInstance), true, 'Well-known symbol as value');

reportCompare(0, 0);