Debian Codegraph @

js/src/tests/test262/built-ins/Iterator/concat/next-method-throws.js

raw
1 // |reftest| shell-option(--enable-iterator-sequencing) skip-if(!Iterator.concat||!xulRuntime.shell) -- iterator-sequencing is not enabled unconditionally, requires shell-options
2 // Copyright (C) 2024 André Bargull. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 esid: sec-iterator.concat
7 description: >
8 Underlying iterator has throwing next method
9 info: |
10 Iterator.concat ( ...items )
11
12 ...
13 3. Let closure be a new Abstract Closure with no parameters that captures iterables and performs the following steps when called:
14 a. For each Record iterable of iterables, do
15 ...
16 v. Repeat, while innerAlive is true,
17 1. Let innerValue be ? IteratorStepValue(iteratorRecord).
18 ...
19 features: [iterator-sequencing]
20 ---*/
21
22 let throwingIterator = {
23 next() {
24 throw new Test262Error();
25 }
26 };
27
28 let iterable = {
29 [Symbol.iterator]() {
30 return throwingIterator;
31 }
32 };
33
34 let iterator = Iterator.concat(iterable);
35
36 assert.throws(Test262Error, function() {
37 iterator.next();
38 });
39
40 reportCompare(0, 0);