Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / Set / prototype / symmetricDifference / converts-negative-zero.js
blobf2a1758ecf0c566247c7dc409763ac9f7db269e8
1 // |reftest| skip -- set-methods is not supported
2 // Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 esid: sec-set.prototype.symmetricdifference
6 description: Set.prototype.symmetricDifference converts -0𝔽 to +0𝔽
7 info: |
8     7.b.ii If nextValue is -0𝔽, set nextValue to +0𝔽.
9 features: [set-methods]
10 includes: [compareArray.js]
11 ---*/
13 const setlikeWithMinusZero = {
14   size: 1,
15   has: function () {
16     throw new Test262Error("Set.prototype.symmetricDifference should not invoke .has on its argument");
17   },
18   keys: function () {
19     // we use an array here because the Set constructor would normalize away -0
20     return [-0].values();
21   },
24 const s1 = new Set([1, 2]);
25 let expected = [1, 2, +0];
26 let combined = s1.symmetricDifference(setlikeWithMinusZero);
28 assert.compareArray([...combined], expected);
29 assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
31 reportCompare(0, 0);