Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / Set / prototype / symmetricDifference / set-like-array.js
blob01a9edd5dbffb93ddb6e1e5045258a0203f39c5d
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 consumes a set-like array as a set-like, not an array
7 features: [set-methods]
8 includes: [compareArray.js]
9 ---*/
11 const s1 = new Set([1, 2]);
12 const s2 = [5];
13 s2.size = 3;
14 s2.has = function (v) {
15   throw new Test262Error("Set.prototype.symmetricDifference should not invoke .has on its argument");
17 s2.keys = function () {
18   return [2, 3, 4].values();
21 const expected = [1, 3, 4];
22 const combined = s1.symmetricDifference(s2);
24 assert.compareArray([...combined], expected);
25 assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
27 reportCompare(0, 0);