OLD | NEW |
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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 try { | 206 try { |
207 int i = 0; | 207 int i = 0; |
208 while (true) { | 208 while (true) { |
209 try { | 209 try { |
210 try { | 210 try { |
211 tracer.trace("a"); | 211 tracer.trace("a"); |
212 throw "Error"; | 212 throw "Error"; |
213 } catch (error) { | 213 } catch (error) { |
214 tracer.trace("b"); | 214 tracer.trace("b"); |
215 try { | 215 try { |
216 await new Future.value(3); /// forceAwait: continued | 216 await new Future.value(3); // /// forceAwait: continued |
217 throw "Error2"; | 217 throw "Error2"; |
218 } catch(error) { | 218 } catch(error) { |
219 tracer.trace("c"); | 219 tracer.trace("c"); |
220 } finally { | 220 } finally { |
221 tracer.trace("d"); | 221 tracer.trace("d"); |
222 } | 222 } |
223 tracer.trace("e"); | 223 tracer.trace("e"); |
224 throw "Error3"; | 224 throw "Error3"; |
225 } finally { | 225 } finally { |
226 tracer.trace("f"); | 226 tracer.trace("f"); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 try { | 302 try { |
303 try { | 303 try { |
304 tracer.trace("a"); | 304 tracer.trace("a"); |
305 return; | 305 return; |
306 } catch (error) { | 306 } catch (error) { |
307 tracer.trace("b"); | 307 tracer.trace("b"); |
308 } finally { | 308 } finally { |
309 tracer.trace("c"); | 309 tracer.trace("c"); |
310 try { | 310 try { |
311 try { | 311 try { |
312 await new Future.value(3); /// forceAwait: continued | 312 await new Future.value(3); // /// forceAwait: continued |
313 tracer.trace("d"); | 313 tracer.trace("d"); |
314 throw "Error"; | 314 throw "Error"; |
315 } finally { | 315 } finally { |
316 tracer.trace("e"); | 316 tracer.trace("e"); |
317 } | 317 } |
318 } finally { | 318 } finally { |
319 tracer.trace("f"); | 319 tracer.trace("f"); |
320 } | 320 } |
321 } | 321 } |
322 } finally { | 322 } finally { |
323 tracer.trace("g"); | 323 tracer.trace("g"); |
324 } | 324 } |
325 tracer.trace("h"); | 325 tracer.trace("h"); |
326 } | 326 } |
327 | 327 |
328 foo14(Tracer tracer) async { | 328 foo14(Tracer tracer) async { |
329 try { | 329 try { |
330 try { | 330 try { |
331 tracer.trace("a"); | 331 tracer.trace("a"); |
332 throw "Error"; | 332 throw "Error"; |
333 } catch (error) { | 333 } catch (error) { |
334 tracer.trace("b"); | 334 tracer.trace("b"); |
335 try { | 335 try { |
336 await new Future.value(3); /// forceAwait: continued | 336 await new Future.value(3); // /// forceAwait: continued |
337 throw "Error2"; | 337 throw "Error2"; |
338 } catch(error) { | 338 } catch(error) { |
339 tracer.trace("c"); | 339 tracer.trace("c"); |
340 } finally { | 340 } finally { |
341 tracer.trace("d"); | 341 tracer.trace("d"); |
342 } | 342 } |
343 tracer.trace("e"); | 343 tracer.trace("e"); |
344 throw "Error3"; | 344 throw "Error3"; |
345 } finally { | 345 } finally { |
346 tracer.trace("f"); | 346 tracer.trace("f"); |
347 } | 347 } |
348 } finally { | 348 } finally { |
349 tracer.trace("g"); | 349 tracer.trace("g"); |
350 } | 350 } |
351 tracer.trace("h"); | 351 tracer.trace("h"); |
352 } | 352 } |
353 | 353 |
354 foo15(Tracer tracer) async { | 354 foo15(Tracer tracer) async { |
355 try { | 355 try { |
356 try { | 356 try { |
357 tracer.trace("a"); | 357 tracer.trace("a"); |
358 throw "Error"; | 358 throw "Error"; |
359 } catch (error) { | 359 } catch (error) { |
360 tracer.trace("b"); | 360 tracer.trace("b"); |
361 try { | 361 try { |
362 await new Future.value(3); /// forceAwait: continued | 362 await new Future.value(3); // /// forceAwait: continued |
363 throw "Error2"; | 363 throw "Error2"; |
364 } catch(error) { | 364 } catch(error) { |
365 tracer.trace("c"); | 365 tracer.trace("c"); |
366 } finally { | 366 } finally { |
367 tracer.trace("d"); | 367 tracer.trace("d"); |
368 } | 368 } |
369 tracer.trace("e"); | 369 tracer.trace("e"); |
370 throw "Error3"; | 370 throw "Error3"; |
371 } finally { | 371 } finally { |
372 tracer.trace("f"); | 372 tracer.trace("f"); |
373 return; | 373 return; |
374 } | 374 } |
375 } finally { | 375 } finally { |
376 tracer.trace("g"); | 376 tracer.trace("g"); |
377 } | 377 } |
378 tracer.trace("h"); | 378 tracer.trace("h"); |
379 } | 379 } |
380 | 380 |
381 foo16(Tracer tracer) async { | 381 foo16(Tracer tracer) async { |
382 try { | 382 try { |
383 try { | 383 try { |
384 tracer.trace("a"); | 384 tracer.trace("a"); |
385 throw "Error"; | 385 throw "Error"; |
386 } catch (error) { | 386 } catch (error) { |
387 tracer.trace("b"); | 387 tracer.trace("b"); |
388 try { | 388 try { |
389 await new Future.value(3); /// forceAwait: continued | 389 await new Future.value(3); // /// forceAwait: continued |
390 throw "Error2"; | 390 throw "Error2"; |
391 } catch(error) { | 391 } catch(error) { |
392 tracer.trace("c"); | 392 tracer.trace("c"); |
393 } finally { | 393 } finally { |
394 tracer.trace("d"); | 394 tracer.trace("d"); |
395 return; | 395 return; |
396 } | 396 } |
397 tracer.trace("e"); | 397 tracer.trace("e"); |
398 throw "Error3"; | 398 throw "Error3"; |
399 } finally { | 399 } finally { |
400 tracer.trace("f"); | 400 tracer.trace("f"); |
401 } | 401 } |
402 } finally { | 402 } finally { |
403 tracer.trace("g"); | 403 tracer.trace("g"); |
404 } | 404 } |
405 tracer.trace("h"); | 405 tracer.trace("h"); |
406 } | 406 } |
407 | 407 |
408 foo17(Tracer tracer) async { | 408 foo17(Tracer tracer) async { |
409 try { | 409 try { |
410 tracer.trace("a"); | 410 tracer.trace("a"); |
411 } finally { | 411 } finally { |
412 try { | 412 try { |
413 tracer.trace("b"); | 413 tracer.trace("b"); |
414 throw "Error"; | 414 throw "Error"; |
415 } catch (error) { | 415 } catch (error) { |
416 await new Future.value(3); /// forceAwait: continued | 416 await new Future.value(3); // /// forceAwait: continued |
417 Expect.equals("Error", error); | 417 Expect.equals("Error", error); |
418 tracer.trace("c"); | 418 tracer.trace("c"); |
419 } finally { | 419 } finally { |
420 tracer.trace("d"); | 420 tracer.trace("d"); |
421 } | 421 } |
422 tracer.trace("e"); | 422 tracer.trace("e"); |
423 } | 423 } |
424 tracer.trace("f"); | 424 tracer.trace("f"); |
425 } | 425 } |
426 | 426 |
427 foo18(Tracer tracer) async { | 427 foo18(Tracer tracer) async { |
428 try { | 428 try { |
429 tracer.trace("a"); | 429 tracer.trace("a"); |
430 } finally { | 430 } finally { |
431 try { | 431 try { |
432 tracer.trace("b"); | 432 tracer.trace("b"); |
433 } finally { | 433 } finally { |
434 await new Future.value(3); /// forceAwait: continued | 434 await new Future.value(3); // /// forceAwait: continued |
435 tracer.trace("c"); | 435 tracer.trace("c"); |
436 } | 436 } |
437 tracer.trace("d"); | 437 tracer.trace("d"); |
438 } | 438 } |
439 tracer.trace("e"); | 439 tracer.trace("e"); |
440 } | 440 } |
441 | 441 |
442 runTest(expectedTrace, fun, [expectedError]) async { | 442 runTest(expectedTrace, fun, [expectedError]) async { |
443 Tracer tracer = new Tracer(expectedTrace, expectedTrace); | 443 Tracer tracer = new Tracer(expectedTrace, expectedTrace); |
444 try { | 444 try { |
(...skipping 23 matching lines...) Expand all Loading... |
468 await runTest("abcdefgX", foo14, "Error3"); | 468 await runTest("abcdefgX", foo14, "Error3"); |
469 await runTest("abcdefg", foo15); | 469 await runTest("abcdefg", foo15); |
470 await runTest("abcdfg", foo16); | 470 await runTest("abcdfg", foo16); |
471 await runTest("abcdef", foo17); | 471 await runTest("abcdef", foo17); |
472 await runTest("abcde", foo18); | 472 await runTest("abcde", foo18); |
473 } | 473 } |
474 | 474 |
475 void main() { | 475 void main() { |
476 asyncTest(test); | 476 asyncTest(test); |
477 } | 477 } |
OLD | NEW |