1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
// |reftest| async
// Copyright (C) 2023 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.fromasync
description: >
Constructs an intrinsic Array if this-value is not a constructor, and length
and element properties are set accordingly.
info: |
3.e. If IsConstructor(_C_) is *true*, then
...
f. Else,
i. Let _A_ be ! ArrayCreate(0).
...
j. If _iteratorRecord_ is not *undefined*, then
...
k. Else,
...
iv. If IsConstructor(_C_) is *true*, then
...
v. Else,
1. Let _A_ be ? ArrayCreate(_len_).
includes: [compareArray.js, asyncHelpers.js]
flags: [async]
features: [Array.fromAsync]
---*/
asyncTest(async function () {
const thisValue = {
length: 4000,
0: 32,
1: 64,
2: 128
};
let result = await Array.fromAsync.call(thisValue, [1, 2]);
assert(Array.isArray(result), "result is an intrinsic Array");
assert.compareArray(result, [1, 2], "result is not disrupted by properties of this-value");
result = await Array.fromAsync.call(thisValue, {
length: 2,
0: 1,
1: 2
});
assert(Array.isArray(result), "result is an intrinsic Array");
assert.compareArray(result, [1, 2], "result is not disrupted by properties of this-value");
});
|