Debian Codegraph @

js/src/tests/test262/built-ins/Iterator/from/primitives.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 Iterator.from throws on primitives (except Strings)
8 info: |
9 Iterator.from ( O )
10
11 features: [iterator-helpers]
12 flags: []
13 ---*/
14
15 assert.throws(TypeError, function () {
16 Iterator.from(null);
17 });
18
19 assert.throws(TypeError, function () {
20 Iterator.from(undefined);
21 });
22
23 assert.throws(TypeError, function () {
24 Iterator.from(0);
25 });
26
27 assert.throws(TypeError, function () {
28 Iterator.from(0n);
29 });
30
31 assert.throws(TypeError, function () {
32 Iterator.from(true);
33 });
34
35 assert.throws(TypeError, function () {
36 Iterator.from(Symbol());
37 });
38
39 Iterator.from('string');
40
41 reportCompare(0, 0);