From 2335745454959f72ce96637f61fb3a502a2e29ac Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Thu, 15 Apr 2021 18:24:08 -0400 Subject: [PATCH] Prettify test output when encoding doesn't match (#907) --- bridges/relays/bin-substrate/src/chains/mod.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bridges/relays/bin-substrate/src/chains/mod.rs b/bridges/relays/bin-substrate/src/chains/mod.rs index 1f6b4134ce841..f33e265f9a870 100644 --- a/bridges/relays/bin-substrate/src/chains/mod.rs +++ b/bridges/relays/bin-substrate/src/chains/mod.rs @@ -259,6 +259,7 @@ mod rococo_tests { extrinsics_root: Default::default(), digest: sp_runtime::generic::Digest { logs: vec![] }, }; + let justification = GrandpaJustification { round: 0, commit: finality_grandpa::Commit { @@ -268,6 +269,7 @@ mod rococo_tests { }, votes_ancestries: vec![], }; + let actual = bp_rococo::BridgeGrandpaWestendCall::submit_finality_proof(header.clone(), justification.clone()); let expected = millau_runtime::BridgeGrandpaRialtoCall::::submit_finality_proof( header, @@ -281,7 +283,7 @@ mod rococo_tests { // then assert_eq!( actual_encoded, expected_encoded, - "Encoding difference. Raw: {:?} vs {:?}", + "\n\nEncoding difference.\nGot {:#?} \nExpected: {:#?}", actual, expected ); } @@ -302,6 +304,7 @@ mod westend_tests { extrinsics_root: Default::default(), digest: sp_runtime::generic::Digest { logs: vec![] }, }; + let justification = GrandpaJustification { round: 0, commit: finality_grandpa::Commit { @@ -311,6 +314,7 @@ mod westend_tests { }, votes_ancestries: vec![], }; + let actual = bp_westend::BridgeGrandpaRococoCall::submit_finality_proof(header.clone(), justification.clone()); let expected = millau_runtime::BridgeGrandpaRialtoCall::::submit_finality_proof( header, @@ -324,7 +328,7 @@ mod westend_tests { // then assert_eq!( actual_encoded, expected_encoded, - "Encoding difference. Raw: {:?} vs {:?}", + "\n\nEncoding difference.\nGot {:#?} \nExpected: {:#?}", actual, expected ); }