rsm: Add a test for <first/>.

This commit is contained in:
Emmanuel Gil Peyrot 2017-05-21 15:41:16 +01:00
parent 61839042bd
commit 16899f8c23

View file

@ -180,4 +180,25 @@ mod tests {
let elem2 = (&rsm).into();
assert_eq!(elem, elem2);
}
#[test]
fn test_first_index() {
let elem: Element = "<set xmlns='http://jabber.org/protocol/rsm'><first index='4'>coucou</first></set>".parse().unwrap();
let set = Set::try_from(&elem).unwrap();
assert_eq!(set.first, Some(String::from("coucou")));
assert_eq!(set.first_index, Some(4));
let set2 = Set {
after: None,
before: None,
count: None,
first: Some(String::from("coucou")),
first_index: Some(4),
index: None,
last: None,
max: None,
};
let elem2 = (&set2).into();
assert_eq!(elem, elem2);
}
}