mirror of https://github.com/tc39/test262.git
Add missed changes for Symbols as WeakMap keys proposal.
Co-authored-by: Rick Waldron <waldron.rick@gmail.com>
This commit is contained in:
parent
f6c48f333e
commit
0593463817
|
@ -68,7 +68,7 @@ assert.throws(TypeError, function() {
|
|||
});
|
||||
assert.sameValue(count, 5);
|
||||
|
||||
nextItem = Symbol('a');
|
||||
nextItem = Symbol.for('a');
|
||||
assert.throws(TypeError, function() {
|
||||
new WeakMap(iterable);
|
||||
});
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
// 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: Returns `this` after adding a new value.
|
||||
info: |
|
||||
WeakSet.prototype.add ( value )
|
||||
|
||||
1. Let S be the this value.
|
||||
...
|
||||
7. Return S.
|
||||
features: [Symbol, WeakSet, symbols-as-weakmap-keys]
|
||||
---*/
|
||||
|
||||
var s = new WeakSet();
|
||||
|
||||
assert.sameValue(s.add(Symbol('description')), s, '`s.add(Symbol("description"))` returns `s`');
|
22
test/built-ins/WeakSet/prototype/add/returns-this-when-ignoring-duplicate-symbol.js
vendored
Normal file
22
test/built-ins/WeakSet/prototype/add/returns-this-when-ignoring-duplicate-symbol.js
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
// 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: Returns `this` when new value is duplicate.
|
||||
info: |
|
||||
WeakSet.prototype.add ( value )
|
||||
|
||||
1. Let S be the this value.
|
||||
...
|
||||
5. 5. For each element e of entries, do
|
||||
a. If e is not empty and SameValue(e, value) is true, then
|
||||
i. Return S.
|
||||
...
|
||||
features: [Symbol, WeakSet, symbols-as-weakmap-keys]
|
||||
---*/
|
||||
|
||||
var foo = Symbol('description');
|
||||
var s = new WeakSet([foo]);
|
||||
|
||||
assert.sameValue(s.add(foo), s, '`s.add(foo)` returns `s`');
|
Loading…
Reference in New Issue