mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
helpers, disco: Add missing serialisation, and add a test.
This commit is contained in:
parent
682bb34b0b
commit
d78a0e6dae
2 changed files with 5 additions and 0 deletions
|
@ -377,6 +377,8 @@ mod tests {
|
||||||
fn test_answers_items_result() {
|
fn test_answers_items_result() {
|
||||||
let elem: Element = "<query xmlns='http://jabber.org/protocol/disco#items'><item jid='component'/><item jid='component2' node='test' name='A component'/></query>".parse().unwrap();
|
let elem: Element = "<query xmlns='http://jabber.org/protocol/disco#items'><item jid='component'/><item jid='component2' node='test' name='A component'/></query>".parse().unwrap();
|
||||||
let query = DiscoItemsResult::try_from(elem).unwrap();
|
let query = DiscoItemsResult::try_from(elem).unwrap();
|
||||||
|
let elem2 = Element::from(query);
|
||||||
|
let query = DiscoItemsResult::try_from(elem2).unwrap();
|
||||||
assert_eq!(query.items.len(), 2);
|
assert_eq!(query.items.len(), 2);
|
||||||
assert_eq!(query.items[0].jid, Jid::from_str("component").unwrap());
|
assert_eq!(query.items[0].jid, Jid::from_str("component").unwrap());
|
||||||
assert_eq!(query.items[0].node, None);
|
assert_eq!(query.items[0].node, None);
|
||||||
|
|
|
@ -340,6 +340,9 @@ macro_rules! generate_element_with_children {
|
||||||
$(
|
$(
|
||||||
.attr($attr_name, elem.$attr)
|
.attr($attr_name, elem.$attr)
|
||||||
)*
|
)*
|
||||||
|
$(
|
||||||
|
.append(elem.$child_ident)
|
||||||
|
)*
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue