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
|
// Copyright (c) 2023 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-object.groupby
description: Object.groupBy called with non-callable throws TypeError
info: |
Object.groupBy ( items, callbackfn )
...
GroupBy ( items, callbackfn, coercion )
2. If IsCallable(callbackfn) is false, throw a TypeError exception.
...
features: [array-grouping]
---*/
assert.throws(TypeError, function() {
Object.groupBy([], null)
}, "null callback throws TypeError");
assert.throws(TypeError, function() {
Object.groupBy([], undefined)
}, "undefined callback throws TypeError");
assert.throws(TypeError, function() {
Object.groupBy([], {})
}, "object callback throws TypeError");
reportCompare(0, 0);
|