simplify tests for invalid JIDs
This commit is contained in:
parent
fd4a513779
commit
c45d1bf5ca
1 changed files with 6 additions and 25 deletions
31
src/lib.rs
31
src/lib.rs
|
@ -421,31 +421,12 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn invalid() {
|
fn invalid_jids() {
|
||||||
match Jid::from_str("") {
|
assert_eq!(Jid::from_str(""), Err(JidParseError::NoDomain));
|
||||||
Err(JidParseError::NoDomain) => (),
|
assert_eq!(Jid::from_str("/c"), Err(JidParseError::NoDomain));
|
||||||
err => panic!("Invalid error: {:?}", err)
|
assert_eq!(Jid::from_str("a@/c"), Err(JidParseError::NoDomain));
|
||||||
}
|
assert_eq!(Jid::from_str("@b"), Err(JidParseError::EmptyNode));
|
||||||
|
assert_eq!(Jid::from_str("b/"), Err(JidParseError::EmptyResource));
|
||||||
match Jid::from_str("a@/c") {
|
|
||||||
Err(JidParseError::NoDomain) => (),
|
|
||||||
err => panic!("Invalid error: {:?}", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
match Jid::from_str("/c") {
|
|
||||||
Err(JidParseError::NoDomain) => (),
|
|
||||||
err => panic!("Invalid error: {:?}", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
match Jid::from_str("@b") {
|
|
||||||
Err(JidParseError::EmptyNode) => (),
|
|
||||||
err => panic!("Invalid error: {:?}", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
match Jid::from_str("b/") {
|
|
||||||
Err(JidParseError::EmptyResource) => (),
|
|
||||||
err => panic!("Invalid error: {:?}", err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "minidom")]
|
#[cfg(feature = "minidom")]
|
||||||
|
|
Loading…
Reference in a new issue