| Index: tests/lib/async/catch_errors.dart
|
| diff --git a/tests/lib/async/catch_errors.dart b/tests/lib/async/catch_errors.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c289690eb1741570891668144f9f222ab04e4b66
|
| --- /dev/null
|
| +++ b/tests/lib/async/catch_errors.dart
|
| @@ -0,0 +1,29 @@
|
| +library catch_errors;
|
| +
|
| +import 'dart:async';
|
| +
|
| +Stream catchErrors(void body()) {
|
| + StreamController controller;
|
| +
|
| + bool onError(e) {
|
| + controller.add(e);
|
| + return true;
|
| + }
|
| +
|
| + void onDone() {
|
| + controller.close();
|
| + }
|
| +
|
| + void onListen() {
|
| + runZonedExperimental(body, onError: onError, onDone: onDone);
|
| + }
|
| +
|
| + controller = new StreamController(onListen: onListen);
|
| + return controller.stream;
|
| +}
|
| +
|
| +Future waitForCompletion(void body()) {
|
| + Completer completer = new Completer.sync();
|
| + runZonedExperimental(body, onDone: completer.complete);
|
| + return completer.future;
|
| +}
|
|
|