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

Unified Diff: tests/language/await_future_test.dart

Issue 538803002: Enable await in for and for-in loops. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase on master Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/await_future_test.dart
diff --git a/tests/language/await_future_test.dart b/tests/language/await_future_test.dart
index 54631f343f255cef3b8acc50628135f33f8323d9..f1e21bc0494767f34536b77b9fa5095aa5bbd31d 100644
--- a/tests/language/await_future_test.dart
+++ b/tests/language/await_future_test.dart
@@ -158,6 +158,27 @@ awaitNestedDoWhile(int i, int j) async {
return k;
}
+awaitFor() async {
+ var asyncInc = (p) async => p+1;
+ var k = 0;
+ for (int j = (await bar(0)), i = (await bar(1));
+ j < (await bar(5));
+ j = (await asyncInc(j)), i = (await asyncInc(i))) {
+ k += i;
+ k += j;
+ }
+ return k;
+}
+
+awaitForIn() async {
+ var list = ['a', 'b', 'c'];
+ var k = '';
+ for (var c in (await bar(list))) {
+ k += c;
+ }
+ return k;
+}
+
main() async {
var result;
for (int i = 0; i < 10; i++) {
@@ -195,5 +216,9 @@ main() async {
Expect.equals(24, result);
result = await awaitAsUnary(bar(1), bar(2));
Expect.equals(3, result);
+ result = await awaitFor();
+ Expect.equals(25, result);
+ result = await awaitForIn();
+ Expect.equals('abc', result);
}
}
« no previous file with comments | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698