Add deserialization tests for IgnoredAny

This commit is contained in:
David Tolnay 2019-06-27 10:07:06 -07:00
parent 4cb13b33e0
commit fccd3e9fba
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -124,6 +124,19 @@ enum EnumOther {
Other,
}
#[derive(PartialEq, Debug)]
struct IgnoredAny;
impl<'de> Deserialize<'de> for IgnoredAny {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
serde::de::IgnoredAny::deserialize(deserializer)?;
Ok(IgnoredAny)
}
}
//////////////////////////////////////////////////////////////////////////
macro_rules! declare_tests {
@ -929,6 +942,21 @@ declare_tests! {
Token::SeqEnd,
],
}
test_ignored_any {
IgnoredAny => &[
Token::Str("s"),
],
IgnoredAny => &[
Token::Seq { len: Some(1) },
Token::Bool(true),
Token::SeqEnd,
],
IgnoredAny => &[
Token::Enum { name: "E" },
Token::Str("Rust"),
Token::Unit,
],
}
}
declare_tests! {