| Index: tests/lib/async/catch_errors13_test.dart
|
| diff --git a/tests/lib/async/catch_errors8_test.dart b/tests/lib/async/catch_errors13_test.dart
|
| similarity index 62%
|
| copy from tests/lib/async/catch_errors8_test.dart
|
| copy to tests/lib/async/catch_errors13_test.dart
|
| index c24c3f96af27887286cc3ba679b5c2618e91ae6e..bac15b99bcfce825ce31f9b9ac824a875d881e5d 100644
|
| --- a/tests/lib/async/catch_errors8_test.dart
|
| +++ b/tests/lib/async/catch_errors13_test.dart
|
| @@ -8,29 +8,32 @@ import 'dart:isolate';
|
|
|
| main() {
|
| // We keep a ReceivePort open until all tests are done. This way the VM will
|
| - // time out if the callbacks are not invoked.
|
| + // hang if the callbacks are not invoked and the test will time out.
|
| var port = new ReceivePort();
|
| var events = [];
|
| - // Test nested `catchErrors`.
|
| - // The nested `catchErrors` throws all kinds of different errors (synchronous
|
| - // and asynchronous). The body of the outer `catchErrors` furthermore has a
|
| - // synchronous `throw`.
|
| + // Work around bug that makes runAsync use Timers. By invoking `runAsync` here
|
| + // we make sure that asynchronous non-timer events are executed before any
|
| + // Timer events.
|
| + runAsync(() { });
|
| +
|
| + // Test that errors are caught by nested `catchErrors`. Also uses `runAsync`
|
| + // in the body of a Timer.
|
| catchErrors(() {
|
| events.add("catch error entry");
|
| catchErrors(() {
|
| events.add("catch error entry2");
|
| - new Future.error("future error");
|
| - new Future.error("future error2");
|
| - new Future.value(499).then((x) => throw x);
|
| - new Future.delayed(const Duration(milliseconds: 50), () {
|
| - throw "delayed error";
|
| - });
|
| - throw "catch error";
|
| + Timer.run(() { throw "timer error"; });
|
| + new Timer(const Duration(milliseconds: 50),
|
| + () {
|
| + runAsync(() { throw "runAsync"; });
|
| + throw "delayed error";
|
| + });
|
| }).listen((x) { events.add(x); })
|
| .asFuture()
|
| .then((_) => events.add("inner done"))
|
| .then((_) { throw "inner done throw"; });
|
| events.add("after inner");
|
| + Timer.run(() { throw "timer outer"; });
|
| throw "inner throw";
|
| }).listen((x) {
|
| events.add(x);
|
| @@ -41,12 +44,11 @@ main() {
|
| "catch error entry2",
|
| "after inner",
|
| "main exit",
|
| - "catch error",
|
| "inner throw",
|
| - "future error",
|
| - "future error2",
|
| - 499,
|
| + "timer error",
|
| + "timer outer",
|
| "delayed error",
|
| + "runAsync",
|
| "inner done",
|
| "inner done throw"
|
| ],
|
|
|