summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/AsyncFromSyncIteratorPrototype/next/absent-value-not-passed.js
blob: ecba51e39c186ae2d29bf7a27b7ef450569317d7 (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
29
30
31
32
33
34
35
36
37
38
// |reftest| async
// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-%asyncfromsynciteratorprototype%.next
description: >
  `next` method does not pass absent `value`.
info: |
  %AsyncFromSyncIteratorPrototype%.next ( value )

  [...]
  5. If value is present, then
    [...]
  6. Else,
    a. Let result be IteratorNext(syncIteratorRecord).
  [...]
flags: [async]
features: [async-iteration]
includes: [asyncHelpers.js]
---*/

var nextArgumentsLength;
var syncIterator = {
  [Symbol.iterator]() {
    return this;
  },
  next() {
    nextArgumentsLength = arguments.length;
    return {done: true};
  },
};

asyncTest(async function () {
  for await (let _ of syncIterator);

  assert.sameValue(nextArgumentsLength, 0);
});