Debian Codegraph @

js/src/tests/test262/built-ins/Iterator/concat/arguments-checked-in-order.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 Arguments are validated in order.
9 info: |
10 Iterator.concat ( ...items )
11
12 1. Let iterables be a new empty List.
13 2. For each element item of items, do
14 a. If item is not an Object, throw a TypeError exception.
15 b. Let method be ? GetMethod(item, %Symbol.iterator%).
16 ...
17 features: [iterator-sequencing]
18 ---*/
19
20 let getIterator = 0;
21
22 let iterable1 = {
23 get [Symbol.iterator]() {
24 getIterator++;
25 return function() {
26 throw new Test262Error();
27 };
28 }
29 };
30
31 let iterable2 = {
32 get [Symbol.iterator]() {
33 throw new Test262Error();
34 }
35 };
36
37 assert.sameValue(getIterator, 0);
38
39 assert.throws(TypeError, function() {
40 Iterator.concat(iterable1, null, iterable2);
41 });
42
43 assert.sameValue(getIterator, 1);
44
45 reportCompare(0, 0);