asyncitems-arraylike-holes.js (738B)
1 // |reftest| async 2 // Copyright (C) 2023 Igalia, S.L. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-array.fromasync 7 description: Array-like object with holes treats the holes as undefined 8 info: | 9 3.k.vii.2. Let _kValue_ be ? Get(_arrayLike_, _Pk_). 10 features: [Array.fromAsync] 11 flags: [async] 12 includes: [asyncHelpers.js, compareArray.js] 13 ---*/ 14 15 asyncTest(async function () { 16 const arrayLike = Object.create(null); 17 arrayLike.length = 5; 18 arrayLike[0] = 0; 19 arrayLike[1] = 1; 20 arrayLike[2] = 2; 21 arrayLike[4] = 4; 22 23 const array = await Array.fromAsync(arrayLike); 24 assert.compareArray(array, [0, 1, 2, undefined, 4], "holes in array-like treated as undefined"); 25 });