Check attr="" parse to Some("") in Option<String>
This commit is contained in:
parent
b3fd0b5372
commit
aa26d98e2a
1 changed files with 31 additions and 0 deletions
|
|
@ -1034,6 +1034,25 @@ fn optional_attribute_extract_positive_present() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn optional_attribute_extract_positive_present_empty() {
|
||||||
|
#[allow(unused_imports)]
|
||||||
|
use std::{
|
||||||
|
option::Option::{None, Some},
|
||||||
|
result::Result::{Err, Ok},
|
||||||
|
};
|
||||||
|
match parse_str::<OptionalAttributeExtract>(
|
||||||
|
"<parent xmlns='urn:example:ns1'><child foo=''/></parent>",
|
||||||
|
) {
|
||||||
|
Ok(OptionalAttributeExtract {
|
||||||
|
contents: Some(contents),
|
||||||
|
}) => {
|
||||||
|
assert_eq!(contents, "");
|
||||||
|
}
|
||||||
|
other => panic!("unexpected result: {:?}", other),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn optional_attribute_extract_positive_absent() {
|
fn optional_attribute_extract_positive_absent() {
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
|
|
@ -1060,6 +1079,18 @@ fn optional_attribute_extract_roundtrip_present() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn optional_attribute_extract_roundtrip_present_empty() {
|
||||||
|
#[allow(unused_imports)]
|
||||||
|
use std::{
|
||||||
|
option::Option::{None, Some},
|
||||||
|
result::Result::{Err, Ok},
|
||||||
|
};
|
||||||
|
roundtrip_full::<OptionalAttributeExtract>(
|
||||||
|
"<parent xmlns='urn:example:ns1'><child foo=''/></parent>",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn optional_attribute_extract_roundtrip_absent() {
|
fn optional_attribute_extract_roundtrip_absent() {
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue