Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / Set / prototype / symmetricDifference / keys-is-callable.js
blob5287340363c385fb1a3c7a25298dcdc6081bf138
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-getsetrecord
6 description: GetSetRecord throws an exception if the Set-like object's 'keys' property is not callable
7 info: |
8     9. Let keys be ? Get(obj, "keys").
9     10. If IsCallable(keys) is false, throw a TypeError exception.
10 features: [set-methods]
11 ---*/
13 const s1 = new Set([1, 2]);
14 const s2 = {
15   size: 2,
16   has: () => {},
17   keys: undefined,
19 assert.throws(
20   TypeError,
21   function () {
22     s1.symmetricDifference(s2);
23   },
24   "GetSetRecord throws an error when keys is undefined"
27 s2.keys = {};
28 assert.throws(
29   TypeError,
30   function () {
31     s1.symmetricDifference(s2);
32   },
33   "GetSetRecord throws an error when keys is not callable"
36 reportCompare(0, 0);