mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
version: Add a serialisation test.
This commit is contained in:
parent
c828f93839
commit
5c79960cee
1 changed files with 14 additions and 0 deletions
|
@ -82,6 +82,7 @@ impl From<Version> for Element {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use compare_elements::NamespaceAwareCompare;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_simple() {
|
fn test_simple() {
|
||||||
|
@ -91,4 +92,17 @@ mod tests {
|
||||||
assert_eq!(version.version, String::from("0.3.0"));
|
assert_eq!(version.version, String::from("0.3.0"));
|
||||||
assert_eq!(version.os, None);
|
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 = "<query xmlns='jabber:iq:version'><name>xmpp-rs</name><version>0.3.0</version></query>".parse().unwrap();
|
||||||
|
println!("{:?}", elem1);
|
||||||
|
assert!(elem1.compare_to(&elem2));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue