mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
rsm: Add a test for <first/>.
This commit is contained in:
parent
61839042bd
commit
16899f8c23
1 changed files with 21 additions and 0 deletions
21
src/rsm.rs
21
src/rsm.rs
|
@ -180,4 +180,25 @@ mod tests {
|
||||||
let elem2 = (&rsm).into();
|
let elem2 = (&rsm).into();
|
||||||
assert_eq!(elem, elem2);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue