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

Unified Diff: tests/language/async_switch_test.dart

Issue 994853003: Fix dart2js for switches in async code with only awaits in the key. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 | « tests/compiler/dart2js/async_await_js_transform_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/async_switch_test.dart
diff --git a/tests/language/async_switch_test.dart b/tests/language/async_switch_test.dart
index 5e70ad65083c6e7bcc14d0176bb8cb2d57ef7487..1e37321117273282779f7889c288e3221af03f03 100644
--- a/tests/language/async_switch_test.dart
+++ b/tests/language/async_switch_test.dart
@@ -50,6 +50,20 @@ foo3(a) async {
return k;
}
+foo4(value) async {
+ int k = 0;
+ switch(await value) {
+ case 1:
+ k += 1;
+ break;
+ case 2:
+ k += 2;
+ return 2 + k;
+ default: k = 2; /// withDefault: ok
+ }
+ return k;
+}
+
futureOf(a) async => await a;
test() async {
@@ -65,6 +79,10 @@ test() async {
Expect.equals(4, await foo3(2));
Expect.equals(2, await foo3(3)); /// withDefault: ok
Expect.equals(0, await foo3(3)); /// none: ok
+ Expect.equals(1, await foo4(futureOf(1)));
+ Expect.equals(4, await foo4(futureOf(2)));
+ Expect.equals(2, await foo4(futureOf(3))); /// withDefault: ok
+ Expect.equals(0, await foo4(futureOf(3))); /// none: ok
}
void main() {
« no previous file with comments | « tests/compiler/dart2js/async_await_js_transform_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698