From 5c79960cee59b677ee2bfe8989972d2377470513 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Mon, 28 May 2018 16:23:23 +0200 Subject: [PATCH] version: Add a serialisation test. --- src/version.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/version.rs b/src/version.rs index 49b23ad..cb87733 100644 --- a/src/version.rs +++ b/src/version.rs @@ -82,6 +82,7 @@ impl From for Element { #[cfg(test)] mod tests { use super::*; + use compare_elements::NamespaceAwareCompare; #[test] fn test_simple() { @@ -91,4 +92,17 @@ mod tests { assert_eq!(version.version, String::from("0.3.0")); assert_eq!(version.os, None); } + + #[test] + fn serialisation() { + let version = Version { + name: String::from("xmpp-rs"), + version: String::from("0.3.0"), + os: None, + }; + let elem1 = Element::from(version); + let elem2: Element = "xmpp-rs0.3.0".parse().unwrap(); + println!("{:?}", elem1); + assert!(elem1.compare_to(&elem2)); + } }