primitives.js (760B)
1 // Copyright (C) 2023 Michael Ficarra. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 esid: sec-iterator.from 5 description: > 6 Iterator.from throws on primitives (except Strings) 7 info: | 8 Iterator.from ( O ) 9 10 features: [iterator-helpers] 11 flags: [] 12 ---*/ 13 14 assert.throws(TypeError, function () { 15 Iterator.from(null); 16 }); 17 18 assert.throws(TypeError, function () { 19 Iterator.from(undefined); 20 }); 21 22 assert.throws(TypeError, function () { 23 Iterator.from(0); 24 }); 25 26 assert.throws(TypeError, function () { 27 Iterator.from(0n); 28 }); 29 30 assert.throws(TypeError, function () { 31 Iterator.from(true); 32 }); 33 34 assert.throws(TypeError, function () { 35 Iterator.from(Symbol()); 36 }); 37 38 Iterator.from('string'); 39 40 reportCompare(0, 0);