summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/WeakSet/prototype/add/returns-this-when-ignoring-duplicate.js
blob: 0757a57d080e4c1a40ab5113cd2f1e2dcde84f01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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-weakset.prototype.add
description: Returns `this` when new value is duplicate.
info: |
  WeakSet.prototype.add ( value )

  1. Let S be this value.
  ...
  6. Repeat for each e that is an element of entries,
    a. If e is not empty and SameValueZero(e, value) is true, then
    i. Return S.
  ...
---*/

var foo = {};
var s = new WeakSet([foo]);

assert.sameValue(s.add(foo), s, '`s.add(foo)` returns `s`');

reportCompare(0, 0);