Debian Codegraph @

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

raw
1 // |reftest| shell-option(--enable-iterator-helpers) skip-if(!this.hasOwnProperty('Iterator')||!xulRuntime.shell) -- iterator-helpers is not enabled unconditionally, requires shell-options
2 // Copyright (C) 2023 Michael Ficarra. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 esid: sec-iterator.from
6 description: >
7 Underlying iterator has throwing next getter
8 info: |
9 Iterator.from ( O )
10
11 4. Let iterated be ? GetIteratorDirect(O).
12
13 features: [iterator-helpers]
14 flags: []
15 ---*/
16 class ThrowingIterator {
17 get next() {
18 throw new Test262Error();
19 }
20 }
21
22 let iterator = new ThrowingIterator();
23
24 assert.throws(Test262Error, function () {
25 Iterator.from(iterator);
26 });
27
28 reportCompare(0, 0);