@@ -154,6 +154,7 @@ struct TestCustomMessageHandler {
154
154
struct OnHandleCustomMessage {
155
155
expect : TestCustomMessage ,
156
156
include_reply_path : bool ,
157
+ custom_data : Option < Vec < u8 > > ,
157
158
}
158
159
159
160
impl TestCustomMessageHandler {
@@ -162,13 +163,28 @@ impl TestCustomMessageHandler {
162
163
}
163
164
164
165
fn expect_message ( & self , message : TestCustomMessage ) {
165
- let expectation = OnHandleCustomMessage { expect : message, include_reply_path : false } ;
166
+ let expectation = OnHandleCustomMessage { expect : message, include_reply_path : false , custom_data : None } ;
166
167
self . expectations . lock ( ) . unwrap ( ) . push_back ( expectation) ;
167
168
}
168
169
169
170
fn expect_message_and_response ( & self , message : TestCustomMessage ) {
170
- let expectation = OnHandleCustomMessage { expect : message, include_reply_path : true } ;
171
- self . expectations . lock ( ) . unwrap ( ) . push_back ( expectation) ;
171
+ self . expectations . lock ( ) . unwrap ( ) . push_back (
172
+ OnHandleCustomMessage {
173
+ expect : message,
174
+ include_reply_path : true ,
175
+ custom_data : None ,
176
+ }
177
+ ) ;
178
+ }
179
+
180
+ fn expect_message_with_custom_data ( & self , message : TestCustomMessage , custom_data : Vec < u8 > ) {
181
+ self . expectations . lock ( ) . unwrap ( ) . push_back (
182
+ OnHandleCustomMessage {
183
+ expect : message,
184
+ include_reply_path : false ,
185
+ custom_data : Some ( custom_data) ,
186
+ }
187
+ ) ;
172
188
}
173
189
174
190
fn get_next_expectation ( & self ) -> OnHandleCustomMessage {
@@ -192,6 +208,7 @@ impl CustomOnionMessageHandler for TestCustomMessageHandler {
192
208
) -> Option < ( Self :: CustomMessage , ResponseInstruction ) > {
193
209
let expectation = self . get_next_expectation ( ) ;
194
210
assert_eq ! ( msg, expectation. expect) ;
211
+ assert_eq ! ( custom_data, expectation. custom_data) ;
195
212
196
213
let response = match msg {
197
214
TestCustomMessage :: Ping => TestCustomMessage :: Pong ,
0 commit comments