Skip to content

Commit

Permalink
Fixes #2415. Update StreamController.broadcast() test according to …
Browse files Browse the repository at this point in the history
…the changed documentation
  • Loading branch information
sgrekhov committed Dec 13, 2023
1 parent ec13218 commit 3ec28fd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
// BSD-style license that can be found in the LICENSE file.

/// @assertion StreamController.broadcast({void onListen(), void onCancel(),
/// bool sync: false})
/// bool sync = false})
/// The controller does not have any internal queue of events, and if there
/// are no listeners at the time the event is added, it will just be dropped,
/// or, if it is an error, be reported as uncaught.
/// are no listeners at the time the event or error is added, it will just be
/// dropped.
///
/// @description Checks that data events are dropped if there are no listeners.
/// @author a.semenov@unipro.ru
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
// BSD-style license that can be found in the LICENSE file.

/// @assertion StreamController.broadcast({void onListen(), void onCancel(),
/// bool sync: false})
/// bool sync = false})
/// The controller does not have any internal queue of events, and if there
/// are no listeners at the time the event is added, it will just be dropped,
/// or, if it is an error, be reported as uncaught.
/// are no listeners at the time the event or error is added, it will just be
/// dropped.
///
/// @description Checks that errors are reported as uncaught if there are no
/// listeners.
/// @description Checks that an error is not reported as uncaught if there are
/// no listeners. The error is just dropped.
/// @issue 29403
/// @author a.semenov@unipro.ru
Expand All @@ -18,6 +18,13 @@ import "../../../Utils/expect.dart";

main() {
StreamController controller = new StreamController.broadcast();
Expect.throws(() => controller.addError("lost event"));
controller.addError("lost error");
asyncStart();
List receivedData = [];
controller.stream.listen((data) => receivedData.add(data), onDone: () {
Expect.listEquals(["event"], receivedData);
asyncEnd();
});
controller.add("event");
controller.close();
}

0 comments on commit 3ec28fd

Please sign in to comment.