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

Side by Side Diff: tests/language_strong/async_throw_in_catch_test.dart

Issue 2768073002: 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 "dart:async"; 5 import "dart:async";
6 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
7 import "package:async_helper/async_helper.dart"; 7 import "package:async_helper/async_helper.dart";
8 8
9 class Tracer { 9 class Tracer {
10 final String expected; 10 final String expected;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 79 }
80 tracer.trace("f"); 80 tracer.trace("f");
81 } 81 }
82 82
83 foo4(Tracer tracer) async { 83 foo4(Tracer tracer) async {
84 try { 84 try {
85 try { 85 try {
86 await new Future.value(3); //# forceAwait: continued 86 await new Future.value(3); //# forceAwait: continued
87 tracer.trace("a"); 87 tracer.trace("a");
88 throw "Error"; 88 throw "Error";
89 } catch(error) { 89 } catch (error) {
90 tracer.trace("b"); 90 tracer.trace("b");
91 Expect.equals("Error", error); 91 Expect.equals("Error", error);
92 throw "Error2"; 92 throw "Error2";
93 } 93 }
94 } catch(error) { 94 } catch (error) {
95 Expect.equals("Error2", error); 95 Expect.equals("Error2", error);
96 tracer.trace("c"); 96 tracer.trace("c");
97 } 97 }
98 tracer.trace("d"); 98 tracer.trace("d");
99
100 } 99 }
101 100
102 foo5(Tracer tracer) async { 101 foo5(Tracer tracer) async {
103 try { 102 try {
104 tracer.trace("a"); 103 tracer.trace("a");
105 try { 104 try {
106 await new Future.value(3); //# forceAwait: continued 105 await new Future.value(3); //# forceAwait: continued
107 tracer.trace("b"); 106 tracer.trace("b");
108 throw "Error"; 107 throw "Error";
109 } catch(error) { 108 } catch (error) {
110 tracer.trace("c"); 109 tracer.trace("c");
111 Expect.equals("Error", error); 110 Expect.equals("Error", error);
112 throw "Error2"; 111 throw "Error2";
113 } 112 }
114 } finally { 113 } finally {
115 tracer.trace("d"); 114 tracer.trace("d");
116 } 115 }
117 tracer.trace("e"); 116 tracer.trace("e");
118
119 } 117 }
120 118
121 foo6(Tracer tracer) async { 119 foo6(Tracer tracer) async {
122 try { 120 try {
123 try { 121 try {
124 await new Future.value(3); //# forceAwait: continued 122 await new Future.value(3); //# forceAwait: continued
125 tracer.trace("a"); 123 tracer.trace("a");
126 throw "Error"; 124 throw "Error";
127 } catch(error) { 125 } catch (error) {
128 tracer.trace("b"); 126 tracer.trace("b");
129 Expect.equals("Error", error); 127 Expect.equals("Error", error);
130 throw "Error2"; 128 throw "Error2";
131 } finally { 129 } finally {
132 tracer.trace("c"); 130 tracer.trace("c");
133 throw "Error3"; 131 throw "Error3";
134 } 132 }
135 } catch(error) { 133 } catch (error) {
136 tracer.trace("d"); 134 tracer.trace("d");
137 Expect.equals("Error3", error); 135 Expect.equals("Error3", error);
138 } 136 }
139 tracer.trace("e"); 137 tracer.trace("e");
140 } 138 }
141 139
142 foo7(Tracer tracer) async { 140 foo7(Tracer tracer) async {
143 try { 141 try {
144 try { 142 try {
145 await new Future.value(3); //# forceAwait: continued 143 await new Future.value(3); //# forceAwait: continued
146 tracer.trace("a"); 144 tracer.trace("a");
147 throw "Error"; 145 throw "Error";
148 } catch(error) { 146 } catch (error) {
149 Expect.equals("Error", error); 147 Expect.equals("Error", error);
150 tracer.trace("b"); 148 tracer.trace("b");
151 throw "Error2"; 149 throw "Error2";
152 } finally { 150 } finally {
153 tracer.trace("c"); 151 tracer.trace("c");
154 throw "Error3"; 152 throw "Error3";
155 } 153 }
156 } finally { 154 } finally {
157 tracer.trace("d"); 155 tracer.trace("d");
158 } 156 }
159 tracer.trace("e"); 157 tracer.trace("e");
160 } 158 }
161 159
162 foo8(Tracer tracer) async { 160 foo8(Tracer tracer) async {
163 try { 161 try {
164 try { 162 try {
165 await new Future.value(3); //# forceAwait: continued 163 await new Future.value(3); //# forceAwait: continued
166 tracer.trace("a"); 164 tracer.trace("a");
167 throw "Error"; 165 throw "Error";
168 } catch(error) { 166 } catch (error) {
169 Expect.equals("Error", error); 167 Expect.equals("Error", error);
170 tracer.trace("b"); 168 tracer.trace("b");
171 return; 169 return;
172 } finally { 170 } finally {
173 tracer.trace("c"); 171 tracer.trace("c");
174 throw "Error3"; 172 throw "Error3";
175 } 173 }
176 } finally { 174 } finally {
177 tracer.trace("d"); 175 tracer.trace("d");
178 } 176 }
179 tracer.trace("e"); 177 tracer.trace("e");
180 } 178 }
181 179
182 foo9(Tracer tracer) async { 180 foo9(Tracer tracer) async {
183 try { 181 try {
184 while(true) { 182 while (true) {
185 try { 183 try {
186 await new Future.value(3); //# forceAwait: continued 184 await new Future.value(3); //# forceAwait: continued
187 tracer.trace("a"); 185 tracer.trace("a");
188 throw "Error"; 186 throw "Error";
189 } catch(error) { 187 } catch (error) {
190 Expect.equals("Error", error); 188 Expect.equals("Error", error);
191 tracer.trace("b"); 189 tracer.trace("b");
192 return; 190 return;
193 } finally { 191 } finally {
194 tracer.trace("c"); 192 tracer.trace("c");
195 break; 193 break;
196 } 194 }
197 tracer.trace("d"); 195 tracer.trace("d");
198 } 196 }
199 } finally { 197 } finally {
200 tracer.trace("e"); 198 tracer.trace("e");
201 } 199 }
202 tracer.trace("f"); 200 tracer.trace("f");
203 } 201 }
204 202
205 foo10(Tracer tracer) async { 203 foo10(Tracer tracer) async {
206 try { 204 try {
207 int i = 0; 205 int i = 0;
208 while (true) { 206 while (true) {
209 try { 207 try {
210 try { 208 try {
211 tracer.trace("a"); 209 tracer.trace("a");
212 throw "Error"; 210 throw "Error";
213 } catch (error) { 211 } catch (error) {
214 tracer.trace("b"); 212 tracer.trace("b");
215 try { 213 try {
216 await new Future.value(3); // //# forceAwait: continued 214 await new Future.value(3); // //# forceAwait: continued
217 throw "Error2"; 215 throw "Error2";
218 } catch(error) { 216 } catch (error) {
219 tracer.trace("c"); 217 tracer.trace("c");
220 } finally { 218 } finally {
221 tracer.trace("d"); 219 tracer.trace("d");
222 } 220 }
223 tracer.trace("e"); 221 tracer.trace("e");
224 throw "Error3"; 222 throw "Error3";
225 } finally { 223 } finally {
226 tracer.trace("f"); 224 tracer.trace("f");
227 // Continue and breaks 'eats' Error3. 225 // Continue and breaks 'eats' Error3.
228 if (i == 0) continue; 226 if (i == 0) continue;
229 if (i == 1) break; 227 if (i == 1) break;
230 } 228 }
231 } finally { 229 } finally {
232 tracer.trace("g"); 230 tracer.trace("g");
233 i++; 231 i++;
234 } 232 }
235 } 233 }
236 } finally { 234 } finally {
237 tracer.trace("h"); 235 tracer.trace("h");
238 } 236 }
239 tracer.trace("i"); 237 tracer.trace("i");
240 } 238 }
241 239
242 foo11(Tracer tracer) async { 240 foo11(Tracer tracer) async {
243 try { 241 try {
244 bool firstTime = true; 242 bool firstTime = true;
245 while(true) { 243 while (true) {
246 tracer.trace("a"); 244 tracer.trace("a");
247 if (firstTime) { 245 if (firstTime) {
248 try { 246 try {
249 await new Future.value(3); //# forceAwait: continued 247 await new Future.value(3); //# forceAwait: continued
250 tracer.trace("b"); 248 tracer.trace("b");
251 throw "Error"; 249 throw "Error";
252 } catch(error) { 250 } catch (error) {
253 Expect.equals("Error", error); 251 Expect.equals("Error", error);
254 tracer.trace("c"); 252 tracer.trace("c");
255 firstTime = false; 253 firstTime = false;
256 continue; 254 continue;
257 } finally { 255 } finally {
258 tracer.trace("d"); 256 tracer.trace("d");
259 } 257 }
260 } else { 258 } else {
261 tracer.trace("e"); 259 tracer.trace("e");
262 return; 260 return;
263 } 261 }
264 } 262 }
265 } finally { 263 } finally {
266 tracer.trace("f"); 264 tracer.trace("f");
267 } 265 }
268 tracer.trace("g"); 266 tracer.trace("g");
269 } 267 }
270 268
271 foo12(Tracer tracer) async { 269 foo12(Tracer tracer) async {
272 try { 270 try {
273 bool firstTime = true; 271 bool firstTime = true;
274 while(true) { 272 while (true) {
275 tracer.trace("a"); 273 tracer.trace("a");
276 if (firstTime) { 274 if (firstTime) {
277 try { 275 try {
278 await new Future.value(3); //# forceAwait: continued 276 await new Future.value(3); //# forceAwait: continued
279 tracer.trace("b"); 277 tracer.trace("b");
280 throw "Error"; 278 throw "Error";
281 } catch(error) { 279 } catch (error) {
282 Expect.equals("Error", error); 280 Expect.equals("Error", error);
283 tracer.trace("c"); 281 tracer.trace("c");
284 firstTime = false; 282 firstTime = false;
285 continue; 283 continue;
286 } finally { 284 } finally {
287 tracer.trace("d"); 285 tracer.trace("d");
288 break; 286 break;
289 } 287 }
290 } else { 288 } else {
291 tracer.trace("e"); 289 tracer.trace("e");
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 foo14(Tracer tracer) async { 326 foo14(Tracer tracer) async {
329 try { 327 try {
330 try { 328 try {
331 tracer.trace("a"); 329 tracer.trace("a");
332 throw "Error"; 330 throw "Error";
333 } catch (error) { 331 } catch (error) {
334 tracer.trace("b"); 332 tracer.trace("b");
335 try { 333 try {
336 await new Future.value(3); // //# forceAwait: continued 334 await new Future.value(3); // //# forceAwait: continued
337 throw "Error2"; 335 throw "Error2";
338 } catch(error) { 336 } catch (error) {
339 tracer.trace("c"); 337 tracer.trace("c");
340 } finally { 338 } finally {
341 tracer.trace("d"); 339 tracer.trace("d");
342 } 340 }
343 tracer.trace("e"); 341 tracer.trace("e");
344 throw "Error3"; 342 throw "Error3";
345 } finally { 343 } finally {
346 tracer.trace("f"); 344 tracer.trace("f");
347 } 345 }
348 } finally { 346 } finally {
349 tracer.trace("g"); 347 tracer.trace("g");
350 } 348 }
351 tracer.trace("h"); 349 tracer.trace("h");
352 } 350 }
353 351
354 foo15(Tracer tracer) async { 352 foo15(Tracer tracer) async {
355 try { 353 try {
356 try { 354 try {
357 tracer.trace("a"); 355 tracer.trace("a");
358 throw "Error"; 356 throw "Error";
359 } catch (error) { 357 } catch (error) {
360 tracer.trace("b"); 358 tracer.trace("b");
361 try { 359 try {
362 await new Future.value(3); // //# forceAwait: continued 360 await new Future.value(3); // //# forceAwait: continued
363 throw "Error2"; 361 throw "Error2";
364 } catch(error) { 362 } catch (error) {
365 tracer.trace("c"); 363 tracer.trace("c");
366 } finally { 364 } finally {
367 tracer.trace("d"); 365 tracer.trace("d");
368 } 366 }
369 tracer.trace("e"); 367 tracer.trace("e");
370 throw "Error3"; 368 throw "Error3";
371 } finally { 369 } finally {
372 tracer.trace("f"); 370 tracer.trace("f");
373 return; 371 return;
374 } 372 }
375 } finally { 373 } finally {
376 tracer.trace("g"); 374 tracer.trace("g");
377 } 375 }
378 tracer.trace("h"); 376 tracer.trace("h");
379 } 377 }
380 378
381 foo16(Tracer tracer) async { 379 foo16(Tracer tracer) async {
382 try { 380 try {
383 try { 381 try {
384 tracer.trace("a"); 382 tracer.trace("a");
385 throw "Error"; 383 throw "Error";
386 } catch (error) { 384 } catch (error) {
387 tracer.trace("b"); 385 tracer.trace("b");
388 try { 386 try {
389 await new Future.value(3); // //# forceAwait: continued 387 await new Future.value(3); // //# forceAwait: continued
390 throw "Error2"; 388 throw "Error2";
391 } catch(error) { 389 } catch (error) {
392 tracer.trace("c"); 390 tracer.trace("c");
393 } finally { 391 } finally {
394 tracer.trace("d"); 392 tracer.trace("d");
395 return; 393 return;
396 } 394 }
397 tracer.trace("e"); 395 tracer.trace("e");
398 throw "Error3"; 396 throw "Error3";
399 } finally { 397 } finally {
400 tracer.trace("f"); 398 tracer.trace("f");
401 } 399 }
(...skipping 17 matching lines...) Expand all
419 } finally { 417 } finally {
420 tracer.trace("d"); 418 tracer.trace("d");
421 } 419 }
422 tracer.trace("e"); 420 tracer.trace("e");
423 } 421 }
424 tracer.trace("f"); 422 tracer.trace("f");
425 } 423 }
426 424
427 foo18(Tracer tracer) async { 425 foo18(Tracer tracer) async {
428 try { 426 try {
429 tracer.trace("a"); 427 tracer.trace("a");
430 } finally { 428 } finally {
431 try { 429 try {
432 tracer.trace("b"); 430 tracer.trace("b");
433 } finally { 431 } finally {
434 await new Future.value(3); // //# forceAwait: continued 432 await new Future.value(3); // //# forceAwait: continued
435 tracer.trace("c"); 433 tracer.trace("c");
436 } 434 }
437 tracer.trace("d"); 435 tracer.trace("d");
438 } 436 }
439 tracer.trace("e"); 437 tracer.trace("e");
(...skipping 27 matching lines...) Expand all
467 await runTest("abcdefgX", foo14, "Error3"); 465 await runTest("abcdefgX", foo14, "Error3");
468 await runTest("abcdefgX", foo14, "Error3"); 466 await runTest("abcdefgX", foo14, "Error3");
469 await runTest("abcdefg", foo15); 467 await runTest("abcdefg", foo15);
470 await runTest("abcdfg", foo16); 468 await runTest("abcdfg", foo16);
471 await runTest("abcdef", foo17); 469 await runTest("abcdef", foo17);
472 await runTest("abcde", foo18); 470 await runTest("abcde", foo18);
473 } 471 }
474 472
475 void main() { 473 void main() {
476 asyncTest(test); 474 asyncTest(test);
477 } 475 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698