Debian Codegraph @

js/src/tests/test262/built-ins/Object/groupBy/callback-throws.js

raw
1 // Copyright (c) 2023 Ecma International. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-object.groupby
6 description: Object.groupBy throws when callback throws
7 info: |
8 Object.groupBy ( items, callbackfn )
9
10 ...
11 GroupBy ( items, callbackfn, coercion )
12
13 6. Repeat,
14 e. Let key be Completion(Call(callbackfn, undefined, « value, 𝔽(k) »)).
15 f. IfAbruptCloseIterator(key, iteratorRecord).
16 ...
17 features: [array-grouping]
18 ---*/
19
20 assert.throws(Test262Error, function() {
21 const array = [1];
22 Object.groupBy(array, function() {
23 throw new Test262Error('throw in callback');
24 })
25 });
26
27 reportCompare(0, 0);