summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Set/prototype/intersection/combines-same-sets.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Set/prototype/intersection/combines-same-sets.js')
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/combines-same-sets.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/combines-same-sets.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/combines-same-sets.js
new file mode 100644
index 0000000000..099c95881e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/combines-same-sets.js
@@ -0,0 +1,21 @@
+// |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.intersection
+description: Set.prototype.intersection can combine Sets that have the same content
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new Set([1, 2]);
+const expected = [1, 2];
+const combined = s1.intersection(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(combined === s1, false, "The returned object is a new object");
+assert.sameValue(combined === s2, false, "The returned object is a new object");
+
+reportCompare(0, 0);