Debian Codegraph @

js/src/tests/test262/built-ins/Array/fromAsync/asyncitems-iterator-not-callable.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: >
8 Array.fromAsync rejects if the @@iterator property is not callable
9 includes: [asyncHelpers.js]
10 flags: [async]
11 features: [Array.fromAsync]
12 ---*/
13
14 asyncTest(async function () {
15 for (const v of [true, "", Symbol(), 1, 1n, {}]) {
16 await assert.throwsAsync(TypeError,
17 () => Array.fromAsync({ [Symbol.iterator]: v }),
18 `@@iterator = ${typeof v}`);
19 }
20 });