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

Unified Diff: tests/language/await_future_test.dart

Issue 508643004: Fix scope/context behavior in await transformer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: addressed comments Created 6 years, 4 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/symbols.h ('k') | tests/standalone/issue14236_test.dart » ('j') | 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 9811f37f171181069532add2933a3c9748fa6ce6..ca6af1868a7d5e04a2fb024486023d49e31ec9b3 100644
--- a/tests/language/await_future_test.dart
+++ b/tests/language/await_future_test.dart
@@ -48,6 +48,35 @@ quazz() async {
}
}
+var result = "";
+
+reset() {
+ result = "";
+}
+
+observe(x) {
+ if (result.length > 0) {
+ result += ",";
+ }
+ result += x;
+}
+
+newTask(x) async => observe(x);
+
+awaitAll(tasks) async {
+ for (var task in tasks) {
+ // This actually opens up a new context level.
+ await task;
+ }
+}
+
+taskTest() async {
+ var tasks = [ newTask('a'), newTask('b'), newTask('c') ];
+ reset();
+ await awaitAll(tasks);
+ Expect.equals('a,b,c', result);
+}
+
main() async {
var result;
for (int i = 0; i < 10; i++) {
@@ -57,5 +86,6 @@ main() async {
Expect.equals(result, 17);
result = await quazz();
Expect.equals(result, 2);
+ await taskTest();
}
}
« no previous file with comments | « runtime/vm/symbols.h ('k') | tests/standalone/issue14236_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698