Reuse AdjacentlyTagged enum in newtype_with_newtype test

This commit is contained in:
Mingun 2024-08-11 23:10:12 +05:00 committed by Mingun
parent 9d0f811221
commit 5445f1741b

View File

@ -482,17 +482,13 @@ fn newtype_with_newtype() {
#[derive(Debug, PartialEq, Serialize, Deserialize)] #[derive(Debug, PartialEq, Serialize, Deserialize)]
struct NewtypeStruct(u32); struct NewtypeStruct(u32);
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "t", content = "c")]
enum E {
Newtype(NewtypeStruct),
Null,
}
assert_de_tokens( assert_de_tokens(
&E::Newtype(NewtypeStruct(5)), &AdjacentlyTagged::Newtype(NewtypeStruct(5)),
&[ &[
Token::Struct { name: "E", len: 2 }, Token::Struct {
name: "AdjacentlyTagged",
len: 2,
},
Token::Str("c"), Token::Str("c"),
Token::NewtypeStruct { Token::NewtypeStruct {
name: "NewtypeStruct", name: "NewtypeStruct",
@ -500,7 +496,7 @@ fn newtype_with_newtype() {
Token::U32(5), Token::U32(5),
Token::Str("t"), Token::Str("t"),
Token::UnitVariant { Token::UnitVariant {
name: "E", name: "AdjacentlyTagged",
variant: "Newtype", variant: "Newtype",
}, },
Token::StructEnd, Token::StructEnd,