Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: test/test262/local-tests/test/language/expressions/async-generators/expression-yield-as-statement.js

Issue 2622833002: WIP [esnext] implement async iteration proposal (Closed)
Patch Set: fix async tests Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 author: Caitlin Potter <caitp@igalia.com>
6 esid: 14.4
7 description: >
8 `yield` is a valid statement within async generator function bodies.
9 flags: [async]
10 ---*/
11
12 var g1 = async function*() { yield; };
13 var g2 = async function*() { yield 1; };
14
15 var iter1 = g1();
16 iter1.next().then(function(result) {
17 assert.sameValue(
18 result.value, undefined, "Without right-hand-side: first result `value`");
19 assert.sameValue(
20 result.done, false, "Without right-hand-side: first result `done` flag");
21 }).then(undefined, $DONE);
22 iter1.next(function(result) {
23 assert.sameValue(
24 result.value, undefined, "Without right-hand-side: second result `value`");
25 assert.sameValue(
26 result.done, true, "Without right-hand-side: second result `done` flag");
27 }).then(undefined, $DONE);
28
29 var iter2 = g2();
30 iter2.next().then(function(result) {
31 assert.sameValue(
32 result.value, 1, "With right-hand-side: first result `value`");
33 assert.sameValue(
34 result.done, false, "With right-hand-side: first result `done` flag");
35 }).then(undefined, $DONE);
36 iter2.next(function(result) {
37 assert.sameValue(
38 result.value, undefined, "With right-hand-side: second result `value`");
39 assert.sameValue(
40 result.done, true, "With right-hand-side: second result `done` flag");
41 }).then($DONE, $DONE);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698