@@ -149,11 +149,6 @@ impl CorrelationWorld {
149149 ///
150150 /// # Panics
151151 /// Panics if the actor fails to run successfully.
152- /// Send messages through a multi-packet response and record them.
153- ///
154- /// # Panics
155- ///
156- /// Panics if sending to the channel fails.
157152 pub async fn process ( & mut self ) {
158153 let cid = self . cid ;
159154 let stream: FrameStream < Envelope > = Box :: pin ( try_stream ! {
@@ -166,16 +161,10 @@ impl CorrelationWorld {
166161 actor. run ( & mut self . frames ) . await . expect ( "actor run failed" ) ;
167162 }
168163
169- /// Verify that all received frames carry the expected correlation id.
170- ///
171- /// # Panics
172- /// Panics if any frame has a `correlation_id` that does not match the
173- /// expected value.
174- /// Verify messages were received in order.
164+ /// Verify that all received frames carry the expected correlation ID.
175165 ///
176166 /// # Panics
177- ///
178- /// Panics if the messages are not in the expected order.
167+ /// Panics if any frame has a `correlation_id` that does not match `self.cid`.
179168 pub fn verify ( & self ) {
180169 assert ! (
181170 self . frames
@@ -197,11 +186,6 @@ impl StreamEndWorld {
197186 ///
198187 /// # Panics
199188 /// Panics if the actor fails to run successfully.
200- /// Send messages through a multi-packet response and record them.
201- ///
202- /// # Panics
203- ///
204- /// Panics if sending to the channel fails.
205189 pub async fn process ( & mut self ) {
206190 let stream: FrameStream < u8 > = Box :: pin ( try_stream ! {
207191 yield 1u8 ;
@@ -233,22 +217,44 @@ impl MultiPacketWorld {
233217 /// Send messages through a multi-packet response and record them.
234218 ///
235219 /// # Panics
236- ///
237220 /// Panics if sending to the channel fails.
238221 pub async fn process ( & mut self ) {
239- let ( tx, rx ) = tokio:: sync:: mpsc:: channel ( 4 ) ;
222+ let ( tx, ch_rx ) = tokio:: sync:: mpsc:: channel ( 4 ) ;
240223 tx. send ( 1u8 ) . await . expect ( "send" ) ;
241224 tx. send ( 2u8 ) . await . expect ( "send" ) ;
242225 tx. send ( 3u8 ) . await . expect ( "send" ) ;
243226 drop ( tx) ;
244- let resp: wireframe:: Response < u8 , ( ) > = wireframe:: Response :: MultiPacket ( rx) ;
245- if let wireframe:: Response :: MultiPacket ( mut rx) = resp {
246- while let Some ( msg) = rx. recv ( ) . await {
227+ let resp: wireframe:: Response < u8 , ( ) > = wireframe:: Response :: MultiPacket ( ch_rx) ;
228+ if let wireframe:: Response :: MultiPacket ( mut mp_rx) = resp {
229+ while let Some ( msg) = mp_rx. recv ( ) . await {
230+ self . messages . push ( msg) ;
231+ }
232+ }
233+ }
234+
235+ /// Send no messages through the channel and record them.
236+ ///
237+ /// # Panics
238+ /// Panics if sending to the channel fails.
239+ pub async fn process_empty ( & mut self ) {
240+ let ( _tx, ch_rx) = tokio:: sync:: mpsc:: channel ( 4 ) ;
241+ drop ( _tx) ;
242+ let resp: wireframe:: Response < u8 , ( ) > = wireframe:: Response :: MultiPacket ( ch_rx) ;
243+ if let wireframe:: Response :: MultiPacket ( mut mp_rx) = resp {
244+ while let Some ( msg) = mp_rx. recv ( ) . await {
247245 self . messages . push ( msg) ;
248246 }
249247 }
250248 }
251249
250+ /// Verify that no messages were received.
251+ ///
252+ /// # Panics
253+ /// Panics if any messages are present.
254+ pub fn verify_empty ( & self ) {
255+ assert ! ( self . messages. is_empty( ) ) ;
256+ }
257+
252258 /// Verify messages were received in order.
253259 ///
254260 /// # Panics
0 commit comments