Skip to content

Commit

Permalink
Add deserialization tests for IgnoredAny
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jun 27, 2019
1 parent 4cb13b3 commit fccd3e9
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test_suite/tests/test_de.rs
Expand Up @@ -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 {
Expand Down Expand Up @@ -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! {
Expand Down

0 comments on commit fccd3e9

Please sign in to comment.