summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/set-like-array.js
blob: 506cf116971a7f50a99b7b61bf3429b1549d6dba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// |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.issupersetof
description: Set.prototype.isSupersetOf consumes a set-like array as a set-like, not an array
features: [set-methods]
---*/

const s1 = new Set([1, 2]);
const s2 = [1];
s2.size = 3;
s2.has = function (v) {
  if (v === 1) return true;
  if (v === 2) return true;
  throw new Test262Error("Set.prototype.isSupersetOf should only call its argument's has method with contents of this");
};
s2.keys = function () {
  throw new Test262Error("Set.prototype.isSupersetOf should not call its argument's keys iterator when this.size ≤ arg.size");
};

assert.sameValue(s1.isSupersetOf(s2), false);

reportCompare(0, 0);