async-iterable-input.js (599B)
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: > 8 Async-iterable input is transferred to the output array. 9 includes: [compareArray.js, asyncHelpers.js] 10 flags: [async] 11 features: [Array.fromAsync] 12 ---*/ 13 14 asyncTest(async function () { 15 const expected = [ 0, 1, 2 ]; 16 17 async function* generateInput () { 18 yield* expected; 19 } 20 21 const input = generateInput(); 22 const output = await Array.fromAsync(input); 23 assert.compareArray(output, expected); 24 });