Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1135)

Unified Diff: tests/lib/async/stream_controller_test.dart

Issue 11953103: Add public-facing method and class that allows intercepting stream events. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/async/stream_pipe.dart ('k') | tests/lib/async/stream_event_transform_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/async/stream_controller_test.dart
diff --git a/tests/lib/async/stream_controller_test.dart b/tests/lib/async/stream_controller_test.dart
index 9dd7509fad0e094b28a5f748ebd33fa245a4d80c..57b99e3699b5395100e8584cbcf627adbe2c6e3c 100644
--- a/tests/lib/async/stream_controller_test.dart
+++ b/tests/lib/async/stream_controller_test.dart
@@ -240,6 +240,42 @@ testSingleController() {
c.add(9);
c.close();
+ // test contains.
+ {
+ c = new StreamController();
+ // Error after match is not important.
+ sentEvents = new Events()..add("a")..add("x")..error("FAIL")..close();
+ Future<bool> contains = c.stream.contains("x");
+ contains.then((var c) {
+ Expect.isTrue(c);
+ });
+ sentEvents.replay(c);
+ }
+
+ {
+ c = new StreamController();
+ // Not matching is ok.
+ sentEvents = new Events()..add("a")..add("x")..add("b")..close();
+ Future<bool> contains = c.stream.contains("y");
+ contains.then((var c) {
+ Expect.isFalse(c);
+ });
+ sentEvents.replay(c);
+ }
+
+ {
+ c = new StreamController();
+ // Error before match makes future err.
+ sentEvents = new Events()..add("a")..error("FAIL")..add("b")..close();
+ Future<bool> contains = c.stream.contains("b");
+ contains.then((var c) {
+ Expect.fail("no value expected");
+ }).catchError((AsyncError e) {
+ Expect.equals("FAIL", e.error);
+ });
+ sentEvents.replay(c);
+ }
+
// Test transform.
c = new StreamController();
sentEvents = new Events()..add("a")..error(42)..add("b")..close();
« no previous file with comments | « sdk/lib/async/stream_pipe.dart ('k') | tests/lib/async/stream_event_transform_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698