From 055caa8e24bc64da170e956c929200ccae5ada20 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 18 Feb 2018 19:41:03 +0100 Subject: [PATCH] add tests for some XML errors --- src/tests.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/tests.rs b/src/tests.rs index e7877158..0db96b70 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -197,3 +197,24 @@ fn namespace_inherited_prefixed2() { assert_eq!(child.name(), "message"); assert_eq!(child.ns(), Some("jabber:client".to_owned())); } + +#[test] +fn xml_error() { + match "".parse::() { + Err(::error::Error(::error::ErrorKind::XmlError(_), _)) => (), + err => panic!("No or wrong error: {:?}", err) + } + + match "() { + Err(::error::Error(::error::ErrorKind::XmlError(_), _)) => (), + err => panic!("No or wrong error: {:?}", err) + } +} + +#[test] +fn invalid_element_error() { + match "".parse::() { + Err(::error::Error(::error::ErrorKind::InvalidElement, _)) => (), + err => panic!("No or wrong error: {:?}", err) + } +}