summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/set-like-array.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/set-like-array.js')
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/set-like-array.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/set-like-array.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/set-like-array.js
new file mode 100644
index 0000000000..01a9edd5db
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/set-like-array.js
@@ -0,0 +1,27 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: Set.prototype.symmetricDifference consumes a set-like array as a set-like, not an array
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = [5];
+s2.size = 3;
+s2.has = function (v) {
+ throw new Test262Error("Set.prototype.symmetricDifference should not invoke .has on its argument");
+};
+s2.keys = function () {
+ return [2, 3, 4].values();
+};
+
+const expected = [1, 3, 4];
+const combined = s1.symmetricDifference(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);