Debian Codegraph @

js/src/tests/test262/built-ins/AsyncGeneratorFunction/has-instance.js

raw
1 // Copyright (C) 2018 Valerie Young. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-properties-of-asyncgeneratorfunction
5 description: >
6 AsyncGenerator function instances are correctly reported as instances of the
7 AsyncGeneratorFunction intrinsic.
8 features: [async-iteration]
9 ---*/
10
11 var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
12
13 async function* agDecl() {}
14 var agExpr = async function* () {};
15
16 assert(
17 agDecl instanceof AsyncGeneratorFunction,
18 'AsyncGenerators created via AsyncGeneratorDeclaration syntax are proper instances of AsyncGeneratorFunction'
19 );
20
21 assert(
22 agExpr instanceof AsyncGeneratorFunction,
23 'AsyncGenerators created via AsyncGeneratorExpression syntax are proper instances of AsyncGeneratorFunction'
24 );
25
26 assert(
27 new AsyncGeneratorFunction() instanceof AsyncGeneratorFunction,
28 'AsyncGenerators created via constructor invocation of AsyncGeneratorFunction are proper instances of AsyncGeneratorFunction'
29 );
30
31 assert(
32 AsyncGeneratorFunction() instanceof AsyncGeneratorFunction,
33 'AsyncGenerators created via function invocation of AsyncGeneratorFunction are proper instances of AsyncGeneratorFunction'
34 );
35
36 reportCompare(0, 0);