Cover Content::Seq case in VariantRefDeserializer::struct_variant
This commit is contained in:
parent
0093f74cfe
commit
6588b0ad37
@ -2217,6 +2217,8 @@ mod content {
|
||||
Some(Content::Map(v)) => {
|
||||
de::Deserializer::deserialize_any(MapRefDeserializer::new(v), visitor)
|
||||
}
|
||||
// Covered by tests/test_enum_untagged.rs
|
||||
// newtype_enum::struct_from_seq
|
||||
Some(Content::Seq(v)) => {
|
||||
de::Deserializer::deserialize_any(SeqRefDeserializer::new(v), visitor)
|
||||
}
|
||||
|
@ -214,6 +214,25 @@ mod newtype_enum {
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// Reaches crate::private::de::content::VariantRefDeserializer::struct_variant
|
||||
// Content::Seq case
|
||||
#[test]
|
||||
fn struct_from_seq() {
|
||||
assert_de_tokens(
|
||||
&Outer::Inner(Inner::Struct { f: 1 }),
|
||||
&[
|
||||
Token::Map { len: Some(1) },
|
||||
// tag
|
||||
Token::Str("Struct"),
|
||||
// content
|
||||
Token::Seq { len: Some(1) },
|
||||
Token::U8(1),
|
||||
Token::SeqEnd,
|
||||
Token::MapEnd,
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Reaches crate::private::de::content::ContentRefDeserializer::deserialize_option
|
||||
|
Loading…
Reference in New Issue
Block a user