Debian Codegraph @

js/src/tests/test262/built-ins/Iterator/from/non-constructible.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) 2020 Rick Waldron. 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 Iterator.from is not constructible.
8
9 Built-in function objects that are not identified as constructors do not implement the [[Construct]] internal method unless otherwise specified in the description of a particular function.
10 features: [iterator-helpers]
11 ---*/
12 function* g() {}
13
14 assert.throws(TypeError, () => {
15 new Iterator.from();
16 });
17
18 assert.throws(TypeError, () => {
19 new Iterator.from(g());
20 });
21
22 assert.throws(TypeError, () => {
23 new class extends Iterator {}.from(g());
24 });
25
26 reportCompare(0, 0);