Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #2415. Update StreamController.broadcast() test according to the changed documentation #2425

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
}