File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -427,6 +427,33 @@ mod tests {
427
427
}
428
428
}
429
429
430
+ #[ test]
431
+ fn from_any_msg_works ( ) {
432
+ // should work with AnyMsg
433
+ let any = AnyMsg {
434
+ type_url : "/cosmos.foo.v1beta.MsgBar" . to_string ( ) ,
435
+ value : Binary :: from_base64 ( "5yu/rQ+HrMcxH1zdga7P5hpGMLE=" ) . unwrap ( ) ,
436
+ } ;
437
+ let msg: CosmosMsg = any. clone ( ) . into ( ) ;
438
+ assert ! ( matches!( msg, CosmosMsg :: Any ( a) if a == any) ) ;
439
+
440
+ // should work with Into<AnyMsg>
441
+ struct IntoAny ;
442
+ impl From < IntoAny > for AnyMsg {
443
+ fn from ( _: IntoAny ) -> Self {
444
+ AnyMsg {
445
+ type_url : "/cosmos.foo.v1beta.MsgBar" . to_string ( ) ,
446
+ value : Binary :: from_base64 ( "5yu/rQ+HrMcxH1zdga7P5hpGMLE=" ) . unwrap ( ) ,
447
+ }
448
+ }
449
+ }
450
+ let msg: CosmosMsg = IntoAny . into ( ) ;
451
+ assert ! ( matches!(
452
+ msg,
453
+ CosmosMsg :: Any ( a) if a == any
454
+ ) ) ;
455
+ }
456
+
430
457
#[ test]
431
458
fn wasm_msg_serializes_to_correct_json ( ) {
432
459
// Instantiate with admin
You can’t perform that action at this time.
0 commit comments