Add test for incorrectly nested elements with transparent
This commit is contained in:
parent
786f035f76
commit
6c4cd8bd55
|
@ -1,4 +1,6 @@
|
||||||
use instant_xml::{from_str, to_string, FromXml, ToXml};
|
use similar_asserts::assert_eq;
|
||||||
|
|
||||||
|
use instant_xml::{from_str, to_string, Error, FromXml, ToXml};
|
||||||
|
|
||||||
#[derive(Debug, Eq, FromXml, PartialEq, ToXml)]
|
#[derive(Debug, Eq, FromXml, PartialEq, ToXml)]
|
||||||
struct Wrapper {
|
struct Wrapper {
|
||||||
|
@ -36,4 +38,10 @@ fn inline() {
|
||||||
let xml = r#"<Wrapper><Foo><i>42</i></Foo><Bar><s>hello</s></Bar></Wrapper>"#;
|
let xml = r#"<Wrapper><Foo><i>42</i></Foo><Bar><s>hello</s></Bar></Wrapper>"#;
|
||||||
assert_eq!(xml, to_string(&v).unwrap());
|
assert_eq!(xml, to_string(&v).unwrap());
|
||||||
assert_eq!(v, from_str(xml).unwrap());
|
assert_eq!(v, from_str(xml).unwrap());
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
from_str::<Wrapper>("<Wrapper><Foo><i>42</i><Bar><s>hello</s></Bar></Foo></Wrapper>")
|
||||||
|
.unwrap_err(),
|
||||||
|
Error::MissingValue("Inline::bar")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue