OLD | NEW |
---|---|
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // Test the event/callback protocol of the stream implementations. | 5 // Test the event/callback protocol of the stream implementations. |
6 library stream_state_test; | 6 library stream_state_test; |
7 | 7 |
8 import "../../../pkg/unittest/lib/unittest.dart"; | 8 import "../../../pkg/unittest/lib/unittest.dart"; |
9 import "stream_state_helper.dart"; | 9 import "stream_state_helper.dart"; |
10 | 10 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 }) | 67 }) |
68 ..expectDone() | 68 ..expectDone() |
69 ..expectBroadcastCancelOpt() | 69 ..expectBroadcastCancelOpt() |
70 ..expectCancel(t.terminate); | 70 ..expectCancel(t.terminate); |
71 t..listen()..add(42); | 71 t..listen()..add(42); |
72 }); | 72 }); |
73 | 73 |
74 test("$p-sub-data-unsubonerror", () { | 74 test("$p-sub-data-unsubonerror", () { |
75 var t = asBroadcast ? new StreamProtocolTest.asBroadcast(sync: sync) | 75 var t = asBroadcast ? new StreamProtocolTest.asBroadcast(sync: sync) |
76 : new StreamProtocolTest(sync: sync); | 76 : new StreamProtocolTest(sync: sync); |
77 t..expectListen() | 77 if (asBroadcast) { |
78 ..expectBroadcastListenOpt() | 78 t..expectListen() |
79 ..expectData(42) | 79 ..expectBroadcastListenOpt() |
floitsch
2013/10/12 18:53:57
You should not need to use "Opt".
This is in the "
Anders Johnsen
2013/10/16 11:52:21
Done.
| |
80 ..expectError("bad") | 80 ..expectData(42) |
81 ..expectBroadcastCancelOpt() | 81 ..expectError("bad") |
82 ..expectCancel(t.terminate); | 82 ..expectBroadcastCancelOpt() |
floitsch
2013/10/12 18:53:57
ditto.
Anders Johnsen
2013/10/16 11:52:21
Done.
| |
83 ..expectCancel(t.terminate); | |
84 } else { | |
85 t..expectListen() | |
86 ..expectBroadcastListenOpt() | |
floitsch
2013/10/12 18:53:57
Remove, since we are in the non-broadcast branch.
Anders Johnsen
2013/10/16 11:52:21
Done.
| |
87 ..expectData(42) | |
88 ..expectCancel() | |
89 ..expectBroadcastCancelOpt() | |
floitsch
2013/10/12 18:53:57
ditto.
Anders Johnsen
2013/10/16 11:52:21
Done.
| |
90 ..expectError("bad", t.terminate); | |
91 } | |
83 t..listen(cancelOnError: true) | 92 t..listen(cancelOnError: true) |
84 ..add(42) | 93 ..add(42) |
85 ..error("bad") | 94 ..error("bad") |
86 ..add(43) | 95 ..add(43) |
87 ..close(); | 96 ..close(); |
88 }); | 97 }); |
Lasse Reichstein Nielsen
2013/10/14 11:32:33
I want to see tests where the close and the cancel
Anders Johnsen
2013/10/16 11:52:21
Done.
| |
89 | 98 |
90 test("$p-sub-data-no-unsubonerror", () { | 99 test("$p-sub-data-no-unsubonerror", () { |
91 var t = asBroadcast ? new StreamProtocolTest.asBroadcast(sync: sync) | 100 var t = asBroadcast ? new StreamProtocolTest.asBroadcast(sync: sync) |
92 : new StreamProtocolTest(sync: sync); | 101 : new StreamProtocolTest(sync: sync); |
93 t..expectListen() | 102 t..expectListen() |
94 ..expectBroadcastListenOpt() | 103 ..expectBroadcastListenOpt() |
95 ..expectData(42) | 104 ..expectData(42) |
96 ..expectError("bad") | 105 ..expectError("bad") |
97 ..expectData(43) | 106 ..expectData(43) |
98 ..expectDone() | 107 ..expectDone() |
(...skipping 19 matching lines...) Expand all Loading... | |
118 t..expectPause(); | 127 t..expectPause(); |
119 } | 128 } |
120 t..expectDone() | 129 t..expectDone() |
121 ..expectBroadcastCancelOpt() | 130 ..expectBroadcastCancelOpt() |
122 ..expectCancel(t.terminate); | 131 ..expectCancel(t.terminate); |
123 t..listen() | 132 t..listen() |
124 ..add(42) | 133 ..add(42) |
125 ..close(); | 134 ..close(); |
126 }); | 135 }); |
127 } | 136 } |
OLD | NEW |