iterables-primitive.js (1140B)
1 // Copyright (C) 2025 André Bargull. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 esid: sec-iterator.zipkeyed 6 description: > 7 Throws a TypeError when the "iterables" argument is not an object. 8 info: | 9 Iterator.zipKeyed ( iterables [ , options ] ) 10 1. If iterables is not an Object, throw a TypeError exception. 11 ... 12 features: [joint-iteration] 13 ---*/ 14 15 var invalidIterables = [ 16 undefined, 17 null, 18 true, 19 "", 20 Symbol(), 21 0, 22 0n, 23 ]; 24 25 // Throws when the "iterables" argument is absent. 26 assert.throws(TypeError, function() { 27 Iterator.zipKeyed(); 28 }); 29 30 // Throws a TypeError for invalid iterables values. 31 for (var iterables of invalidIterables) { 32 assert.throws(TypeError, function() { 33 Iterator.zipKeyed(iterables); 34 }); 35 } 36 37 // Options argument not read when iterables is not an object. 38 var badOptions = { 39 get mode() { 40 throw new Test262Error(); 41 }, 42 get padding() { 43 throw new Test262Error(); 44 } 45 }; 46 for (var iterables of invalidIterables) { 47 assert.throws(TypeError, function() { 48 Iterator.zipKeyed(iterables, badOptions); 49 }); 50 } 51 52 reportCompare(0, 0);