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

Unified Diff: test/codegen/language/async_continue_label_test.dart

Issue 1243503007: fixes #221, initial sync*, async, async* implementation (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 5 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
Index: test/codegen/language/async_continue_label_test.dart
diff --git a/test/codegen/language/async_continue_label_test.dart b/test/codegen/language/async_continue_label_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..d2d7cc85e9077d056b005e66060f7b573f0a1332
--- /dev/null
+++ b/test/codegen/language/async_continue_label_test.dart
@@ -0,0 +1,104 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+// Two loop variables
+test1() async {
+ var r = 0;
+ label:
+ for(var i = 1, j =
+ await /// await_in_init: ok
+ 10; i < 10 && j >
+ await /// await_in_condition: ok
+ -5; j--, i +=
+ await /// await_in_update: ok
+ 1) {
+ if (i <
+ await /// await_in_body: ok
+ 5 || j < -5) {
+ continue label;
+ }
+ r++;
+ }
+ Expect.equals(5, r);
+}
+
+// One loop variable
+test2() async {
+ var r = 0;
+ label:
+ for(var i =
+ await /// await_in_init: ok
+ 0; i <
+ await /// await_in_condition: ok
+ 10; i +=
+ await /// await_in_update: ok
+ 1) {
+ if (i <
+ await /// await_in_body: ok
+ 5) {
+ continue label;
+ }
+ r++;
+ }
+ Expect.equals(5, r);
+}
+
+// Variable not declared in initializer;
+test3() async {
+ var r = 0, i, j;
+ label:
+ for(i =
+ await /// await_in_init: ok
+ 0; i <
+ await /// await_in_condition: ok
+ 10; i +=
+ await /// await_in_update: ok
+ 1) {
+ if (i <
+ await /// await_in_body: ok
+ 5) {
+ continue label;
+ }
+ r++;
+ }
+ Expect.equals(5, r);
+}
+
+// Nested loop
+test4() async {
+ var r = 0;
+ label:
+ for(var i =
+ await /// await_in_init: ok
+ 0; i <
+ await /// await_in_condition: ok
+ 10; i+=
+ await /// await_in_update: ok
+ 1) {
+ if (i <
+ await /// await_in_body: ok
+ 5) {
+ for (int i = 0; i < 10; i++) {
+ continue label;
+ }
+ }
+ r++;
+ }
+ Expect.equals(5, r);
+}
+
+test() async {
+ await test1();
+ await test2();
+ await test3();
+ await test4();
+}
+
+main() {
+ asyncStart();
+ test().then((_) => asyncEnd());
+}
« no previous file with comments | « test/codegen/language/async_break_in_finally_test.dart ('k') | test/codegen/language/async_control_structures_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698