Debian Codegraph @

js/src/tests/test262/built-ins/Array/fromAsync/thisarg-object.js

raw
1 // |reftest| async
2 // Copyright (C) 2022 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: If thisArg is an object, it's bound to mapfn as the this-value
8 info: |
9 6. If _mapping_ is *true*, then
10 a. Let _mappedValue_ be Call(_mapfn_, _thisArg_, « _nextValue_, 𝔽(_k_) »).
11 flags: [async]
12 includes: [asyncHelpers.js]
13 features: [Array.fromAsync]
14 ---*/
15
16 asyncTest(async () => {
17 const myThisValue = {};
18
19 await Array.fromAsync([1, 2, 3], async function () {
20 assert.sameValue(this, myThisValue, "thisArg should be bound as the this-value of mapfn");
21 }, myThisValue);
22 });