summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/AsyncGeneratorPrototype/next/return-promise.js
blob: b6b0689408377201f09533a7242519b5b78e7c59 (plain)
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
// Copyright (C) 2018 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-asyncgenerator-prototype-next
description: >
  "next" returns a promise for an IteratorResult object
info: |
  AsyncGenerator.prototype.next ( value )
  1. Let generator be the this value.
  2. Let completion be NormalCompletion(value).
  3. Return ! AsyncGeneratorEnqueue(generator, completion).

  AsyncGeneratorEnqueue ( generator, completion )
  ...
  2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
  ...
  9. Return promiseCapability.[[Promise]].

features: [async-iteration]
---*/

async function* g() {}
var result = g().next()

assert(result instanceof Promise)

reportCompare(0, 0);