diff --git a/test/built-ins/WeakMap/iterator-items-are-not-object-close-iterator.js b/test/built-ins/WeakMap/iterator-items-are-not-object-close-iterator.js index 121c0ce76f..e4cf3bc73a 100644 --- a/test/built-ins/WeakMap/iterator-items-are-not-object-close-iterator.js +++ b/test/built-ins/WeakMap/iterator-items-are-not-object-close-iterator.js @@ -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); }); diff --git a/test/built-ins/WeakSet/prototype/add/returns-this-symbol.js b/test/built-ins/WeakSet/prototype/add/returns-this-symbol.js new file mode 100644 index 0000000000..8c1d610793 --- /dev/null +++ b/test/built-ins/WeakSet/prototype/add/returns-this-symbol.js @@ -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`'); diff --git a/test/built-ins/WeakSet/prototype/add/returns-this-when-ignoring-duplicate-symbol.js b/test/built-ins/WeakSet/prototype/add/returns-this-when-ignoring-duplicate-symbol.js new file mode 100644 index 0000000000..800346e3e7 --- /dev/null +++ b/test/built-ins/WeakSet/prototype/add/returns-this-when-ignoring-duplicate-symbol.js @@ -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`');