blocking, jingle_ft: Split #[cfg] sections into their own tests.

This commit is contained in:
Emmanuel Gil Peyrot 2019-01-12 20:41:40 +01:00
commit 8b15728bb2
2 changed files with 46 additions and 42 deletions

View file

@ -155,17 +155,6 @@ mod tests {
},
];
#[cfg(not(feature = "compat"))]
{
let request_elem = elem.clone();
let error = BlocklistRequest::try_from(request_elem).unwrap_err();
let message = match error {
Error::ParseError(string) => string,
_ => panic!(),
};
assert_eq!(message, "Unknown child in blocklist element.");
}
let result_elem = elem.clone();
let result = BlocklistResult::try_from(result_elem).unwrap();
assert_eq!(result.items, two_items);
@ -221,4 +210,16 @@ mod tests {
};
assert_eq!(message, "Unknown attribute in unblock element.");
}
#[cfg(not(feature = "compat"))]
#[test]
fn test_non_empty_blocklist_request() {
let elem: Element = "<blocklist xmlns='urn:xmpp:blocking'><item jid='coucou@coucou'/><item jid='domain'/></blocklist>".parse().unwrap();
let error = BlocklistRequest::try_from(elem).unwrap_err();
let message = match error {
Error::ParseError(string) => string,
_ => panic!(),
};
assert_eq!(message, "Unknown child in blocklist element.");
}
}