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

Side by Side Diff: tests/language/async_continue_label_test.dart

Issue 2774783002: Re-land "Format all multitests" (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import "package:async_helper/async_helper.dart"; 6 import "package:async_helper/async_helper.dart";
7 7
8 // Two loop variables 8 // Two loop variables
9 test1() async { 9 test1() async {
10 var r = 0; 10 var r = 0;
11 label: 11 label:
12 for(var i = 1, j = 12 for (var i = 1,
13 j =
13 await //# await_in_init: ok 14 await //# await_in_init: ok
14 10; i < 10 && j > 15 10;
16 i < 10 &&
17 j >
15 await //# await_in_condition: ok 18 await //# await_in_condition: ok
16 -5; j--, i += 19 -5;
20 j--,
21 i +=
17 await //# await_in_update: ok 22 await //# await_in_update: ok
18 1) { 23 1) {
19 if (i < 24 if (i <
20 await //# await_in_body: ok 25 await //# await_in_body: ok
21 5 || j < -5) { 26 5 ||
27 j < -5) {
22 continue label; 28 continue label;
23 } 29 }
24 r++; 30 r++;
25 } 31 }
26 Expect.equals(5, r); 32 Expect.equals(5, r);
27 } 33 }
28 34
29 // One loop variable 35 // One loop variable
30 test2() async { 36 test2() async {
31 var r = 0; 37 var r = 0;
32 label: 38 label:
33 for(var i = 39 for (var i =
34 await //# await_in_init: ok 40 await //# await_in_init: ok
35 0; i < 41 0;
42 i <
36 await //# await_in_condition: ok 43 await //# await_in_condition: ok
37 10; i += 44 10;
45 i +=
38 await //# await_in_update: ok 46 await //# await_in_update: ok
39 1) { 47 1) {
40 if (i < 48 if (i <
41 await //# await_in_body: ok 49 await //# await_in_body: ok
42 5) { 50 5) {
43 continue label; 51 continue label;
44 } 52 }
45 r++; 53 r++;
46 } 54 }
47 Expect.equals(5, r); 55 Expect.equals(5, r);
48 } 56 }
49 57
50 // Variable not declared in initializer; 58 // Variable not declared in initializer;
51 test3() async { 59 test3() async {
52 var r = 0, i, j; 60 var r = 0, i, j;
53 label: 61 label:
54 for(i = 62 for (i =
55 await //# await_in_init: ok 63 await //# await_in_init: ok
56 0; i < 64 0;
65 i <
57 await //# await_in_condition: ok 66 await //# await_in_condition: ok
58 10; i += 67 10;
68 i +=
59 await //# await_in_update: ok 69 await //# await_in_update: ok
60 1) { 70 1) {
61 if (i < 71 if (i <
62 await //# await_in_body: ok 72 await //# await_in_body: ok
63 5) { 73 5) {
64 continue label; 74 continue label;
65 } 75 }
66 r++; 76 r++;
67 } 77 }
68 Expect.equals(5, r); 78 Expect.equals(5, r);
69 } 79 }
70 80
71 // Nested loop 81 // Nested loop
72 test4() async { 82 test4() async {
73 var r = 0; 83 var r = 0;
74 label: 84 label:
75 for(var i = 85 for (var i =
76 await //# await_in_init: ok 86 await //# await_in_init: ok
77 0; i < 87 0;
88 i <
78 await //# await_in_condition: ok 89 await //# await_in_condition: ok
79 10; i+= 90 10;
91 i +=
80 await //# await_in_update: ok 92 await //# await_in_update: ok
81 1) { 93 1) {
82 if (i < 94 if (i <
83 await //# await_in_body: ok 95 await //# await_in_body: ok
84 5) { 96 5) {
85 for (int i = 0; i < 10; i++) { 97 for (int i = 0; i < 10; i++) {
86 continue label; 98 continue label;
87 } 99 }
88 } 100 }
89 r++; 101 r++;
90 } 102 }
91 Expect.equals(5, r); 103 Expect.equals(5, r);
92 } 104 }
93 105
94 test() async { 106 test() async {
95 await test1(); 107 await test1();
96 await test2(); 108 await test2();
97 await test3(); 109 await test3();
98 await test4(); 110 await test4();
99 } 111 }
100 112
101 main() { 113 main() {
102 asyncStart(); 114 asyncStart();
103 test().then((_) => asyncEnd()); 115 test().then((_) => asyncEnd());
104 } 116 }
OLDNEW
« no previous file with comments | « tests/language/async_await_syntax_test.dart ('k') | tests/language/async_or_generator_return_type_stacktrace_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698