diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Map/groupBy/iterator-next-throws.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Map/groupBy/iterator-next-throws.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Map/groupBy/iterator-next-throws.js b/js/src/tests/test262/built-ins/Map/groupBy/iterator-next-throws.js new file mode 100644 index 0000000000..024452ccdd --- /dev/null +++ b/js/src/tests/test262/built-ins/Map/groupBy/iterator-next-throws.js @@ -0,0 +1,36 @@ +// Copyright (c) 2023 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-map.groupby +description: Map.groupBy throws when iterator next throws +info: | + Map.groupBy ( items, callbackfn ) + + ... + + GroupBy ( items, callbackfn, coercion ) + + 6. Repeat, + b. Let next be ? IteratorStep(iteratorRecord). + + ... +features: [array-grouping, Map, Symbol.iterator] +---*/ + +const throwingIterator = { + [Symbol.iterator]: function () { + return this; + }, + next: function next() { + throw new Test262Error('next() method was called'); + } +}; + +assert.throws(Test262Error, function () { + Map.groupBy(throwingIterator, function () { + return 'key'; + }); +}); + +reportCompare(0, 0); |