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

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

Issue 989503002: Fix dart2js async error handling of finallies nested in finallies. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/compiler/lib/src/js/rewrite_async.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 throw "Error3"; 397 throw "Error3";
398 } finally { 398 } finally {
399 tracer.trace("f"); 399 tracer.trace("f");
400 } 400 }
401 } finally { 401 } finally {
402 tracer.trace("g"); 402 tracer.trace("g");
403 } 403 }
404 tracer.trace("h"); 404 tracer.trace("h");
405 } 405 }
406 406
407 foo17(Tracer tracer) async {
408 try {
409 tracer.trace("a");
410 } finally {
411 try {
412 tracer.trace("b");
413 throw "Error";
414 } catch (error) {
415 await new Future.value(3); /// forceAwait: continued
416 Expect.equals("Error", error);
417 tracer.trace("c");
418 } finally {
419 tracer.trace("d");
420 }
421 tracer.trace("e");
422 }
423 tracer.trace("f");
424 }
425
426 foo18(Tracer tracer) async {
427 try {
428 tracer.trace("a");
429 } finally {
430 try {
431 tracer.trace("b");
432 } finally {
433 await new Future.value(3); /// forceAwait: continued
434 tracer.trace("c");
435 }
436 tracer.trace("d");
437 }
438 tracer.trace("e");
439 }
440
407 runTest(expectedTrace, fun, [expectedError]) async { 441 runTest(expectedTrace, fun, [expectedError]) async {
408 Tracer tracer = new Tracer(expectedTrace); 442 Tracer tracer = new Tracer(expectedTrace);
409 try { 443 try {
410 await fun(tracer); 444 await fun(tracer);
411 } catch (error) { 445 } catch (error) {
412 Expect.equals(expectedError, error); 446 Expect.equals(expectedError, error);
413 tracer.trace("X"); 447 tracer.trace("X");
414 } 448 }
415 tracer.done(); 449 tracer.done();
416 } 450 }
417 451
418 test() async { 452 test() async {
419 await runTest("abceX", foo1, "Error2"); 453 await runTest("abceX", foo1, "Error2");
420 await runTest("abdeX", foo2, "Error2"); 454 await runTest("abdeX", foo2, "Error2");
421 await runTest("abde", foo3); 455 await runTest("abde", foo3);
422 await runTest("abcd", foo4); 456 await runTest("abcd", foo4);
423 await runTest("abcdX", foo5, "Error2"); 457 await runTest("abcdX", foo5, "Error2");
424 await runTest("abcde", foo6); 458 await runTest("abcde", foo6);
425 await runTest("abcdX", foo7, "Error3"); 459 await runTest("abcdX", foo7, "Error3");
426 await runTest("abcdX", foo8, "Error3"); 460 await runTest("abcdX", foo8, "Error3");
427 await runTest("abcef", foo9); 461 await runTest("abcef", foo9);
428 await runTest("abcdefgabcdefghi", foo10); 462 await runTest("abcdefgabcdefghi", foo10);
429 await runTest("abcdaef", foo11); 463 await runTest("abcdaef", foo11);
430 await runTest("abcdfg", foo12); 464 await runTest("abcdfg", foo12);
431 await runTest("acdefgX", foo13, "Error"); 465 await runTest("acdefgX", foo13, "Error");
432 await runTest("abcdefgX", foo14, "Error3"); 466 await runTest("abcdefgX", foo14, "Error3");
433 await runTest("abcdefgX", foo14, "Error3"); 467 await runTest("abcdefgX", foo14, "Error3");
434 await runTest("abcdefg", foo15); 468 await runTest("abcdefg", foo15);
435 await runTest("abcdfg", foo16); 469 await runTest("abcdfg", foo16);
470 await runTest("abcdef", foo17);
471 await runTest("abcde", foo18);
436 } 472 }
437 473
438 void main() { 474 void main() {
439 asyncTest(test); 475 asyncTest(test);
440 } 476 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js/rewrite_async.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698