diff --git a/src/component/test.rs b/src/component/test.rs index 93b9ac5..baa6e0c 100644 --- a/src/component/test.rs +++ b/src/component/test.rs @@ -43,7 +43,7 @@ impl fmt::Debug for Expect { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "Expect::")?; match self { - Expect::Element(el) => write!(f, "Element({:?})", String::from(el)), + Expect::Element(el) => write!(f, "Element({})", String::from(el)), Expect::Iq(_, desc) => write!(f, "Iq(, {})", desc), Expect::Message(_, desc) => write!(f, "Message(, {})", desc), Expect::Presence(_, desc) => write!(f, "Presence(, {})", desc), @@ -167,7 +167,17 @@ impl Component { match expected { Some(expected) => match expected { - Expect::Element(el) => assert_eq!(String::from(&el), String::from(&out)), + Expect::Element(el) => { + let (expected, actual) = (String::from(&el), String::from(&out)); + if expected != actual { + panic!( + r#"assertion failed: `(actual == expected)` + actual: `{}`, + expected: `{}`"#, + actual, expected + ) + } + } Expect::Iq(cb, _) => match Iq::try_from(out.0.clone()) { Ok(iq) => cb(iq), _ => panic!(