tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

non-iterable-input.js (640B)


      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  Non iterable input without thenables 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  const input = {
     17    length: 3,
     18    0: 0,
     19    1: 1,
     20    2: 2,
     21    3: 3, // This is ignored because the length is 3.
     22  };
     23  const output = await Array.fromAsync(input);
     24  assert.compareArray(output, expected);
     25 });