Skip to content

Commit 1863987

Browse files
authored
Fixes #2415. Update StreamController.broadcast() test according to the changed documentation (#2425)
1 parent d5d1df8 commit 1863987

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

LibTest/async/StreamController/StreamController.broadcast_A03_t01.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
/// @assertion StreamController.broadcast({void onListen(), void onCancel(),
6-
/// bool sync: false})
6+
/// bool sync = false})
77
/// The controller does not have any internal queue of events, and if there
8-
/// are no listeners at the time the event is added, it will just be dropped,
9-
/// or, if it is an error, be reported as uncaught.
8+
/// are no listeners at the time the event or error is added, it will just be
9+
/// dropped.
1010
///
1111
/// @description Checks that data events are dropped if there are no listeners.
1212
/// @author [email protected]

LibTest/async/StreamController/StreamController.broadcast_A03_t02.dart

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
/// @assertion StreamController.broadcast({void onListen(), void onCancel(),
6-
/// bool sync: false})
6+
/// bool sync = false})
77
/// The controller does not have any internal queue of events, and if there
8-
/// are no listeners at the time the event is added, it will just be dropped,
9-
/// or, if it is an error, be reported as uncaught.
8+
/// are no listeners at the time the event or error is added, it will just be
9+
/// dropped.
1010
///
11-
/// @description Checks that errors are reported as uncaught if there are no
12-
/// listeners.
11+
/// @description Checks that an error is not reported as uncaught if there are
12+
/// no listeners. The error is just dropped.
1313
/// @issue 29403
1414
/// @author [email protected]
1515
@@ -18,6 +18,13 @@ import "../../../Utils/expect.dart";
1818

1919
main() {
2020
StreamController controller = new StreamController.broadcast();
21-
Expect.throws(() => controller.addError("lost event"));
21+
controller.addError("lost error");
22+
asyncStart();
23+
List receivedData = [];
24+
controller.stream.listen((data) => receivedData.add(data), onDone: () {
25+
Expect.listEquals(["event"], receivedData);
26+
asyncEnd();
27+
});
28+
controller.add("event");
2229
controller.close();
2330
}

0 commit comments

Comments
 (0)