Debian Codegraph @

js/src/tests/test262/built-ins/Iterator/concat/fresh-iterator-result.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 Returns a fresh iterator result object
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 2. If innerValue is done, then
19 ...
20 3. Else,
21 a. Let completion be Completion(Yield(innerValue)).
22 ...
23 features: [iterator-sequencing]
24 ---*/
25
26 let oldIterResult = {
27 done: false,
28 value: 123,
29 };
30
31 let testIterator = {
32 next() {
33 return oldIterResult;
34 }
35 };
36
37 let iterable = {
38 [Symbol.iterator]() {
39 return testIterator;
40 }
41 };
42
43 let iterator = Iterator.concat(iterable);
44
45 let iterResult = iterator.next();
46
47 assert.sameValue(iterResult.done, false);
48 assert.sameValue(iterResult.value, 123);
49
50 assert.sameValue(iterResult, oldIterResult);
51
52 reportCompare(0, 0);