Index: lib/src/backend/live_test_controller.dart |
diff --git a/lib/src/backend/live_test_controller.dart b/lib/src/backend/live_test_controller.dart |
index 17b8bcfdd30469a7643356e6f9168b184f0cc11d..a1a0d3a5efde2131b932a215a922979ab1cf6683 100644 |
--- a/lib/src/backend/live_test_controller.dart |
+++ b/lib/src/backend/live_test_controller.dart |
@@ -32,6 +32,8 @@ class _LiveTest extends LiveTest { |
Stream<AsyncError> get onError => _controller._onErrorController.stream; |
+ Stream<String> get onPrint => _controller._onPrintController.stream; |
+ |
Future get onComplete => _controller.completer.future; |
Future run() => _controller._run(); |
@@ -76,10 +78,24 @@ class LiveTestController { |
var _state = const State(Status.pending, Result.success); |
/// The controller for [LiveTest.onStateChange]. |
- final _onStateChangeController = new StreamController<State>.broadcast(); |
+ /// |
+ /// This is synchronous to ensure that events are well-ordered across multiple |
+ /// streams. |
+ final _onStateChangeController = new StreamController<State> |
+ .broadcast(sync: true); |
/// The controller for [LiveTest.onError]. |
- final _onErrorController = new StreamController<AsyncError>.broadcast(); |
+ /// |
+ /// This is synchronous to ensure that events are well-ordered across multiple |
+ /// streams. |
+ final _onErrorController = new StreamController<AsyncError> |
+ .broadcast(sync: true); |
+ |
+ /// The controller for [LiveTest.onPrint]. |
+ /// |
+ /// This is synchronous to ensure that events are well-ordered across multiple |
+ /// streams. |
+ final _onPrintController = new StreamController<String>.broadcast(sync: true); |
/// The completer for [LiveTest.onComplete]; |
final completer = new Completer(); |
@@ -130,6 +146,9 @@ class LiveTestController { |
_onStateChangeController.add(newState); |
} |
+ /// Emits a line printed by the test over [LiveTest.onPrint]. |
+ void print(String line) => _onPrintController.add(line); |
+ |
/// A wrapper for [_onRun] that ensures that it follows the guarantees for |
/// [LiveTest.run]. |
Future _run() { |