blob: 8bb54ea4ad089ce5fb5b27b914ffd8ed60294a2e (
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// |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 works on subclasses of Set, but never calls the receiver's size/has/keys methods
features: [set-methods]
---*/
let sizeCount = 0;
let hasCount = 0;
let keysCount = 0;
class MySet extends Set {
size(...rest) {
sizeCount++;
return super.size(...rest);
}
has(...rest) {
hasCount++;
return super.has(...rest);
}
keys(...rest) {
keysCount++;
return super.keys(...rest);
}
}
const s1 = new MySet([1, 2]);
const s2 = new Set([2, 3]);
const result = s1.isSupersetOf(s2);
assert.sameValue(result, false);
assert.sameValue(sizeCount, 0, "size should not be called on the receiver");
assert.sameValue(hasCount, 0, "has should not be called on the receiver");
assert.sameValue(keysCount, 0, "keys should not be called on the receiver");
reportCompare(0, 0);
|