From 2d75ef6b30c21022f457d673b2ed5a715c153515 Mon Sep 17 00:00:00 2001 From: Mingun Date: Mon, 7 Aug 2023 21:47:55 +0500 Subject: [PATCH] Reuse type in newtype_variant_containing_unit --- .../tests/test_enum_internally_tagged.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/test_suite/tests/test_enum_internally_tagged.rs b/test_suite/tests/test_enum_internally_tagged.rs index b7ff4615..646b1454 100644 --- a/test_suite/tests/test_enum_internally_tagged.rs +++ b/test_suite/tests/test_enum_internally_tagged.rs @@ -24,6 +24,7 @@ struct Struct { #[serde(tag = "tag")] enum InternallyTagged { Unit, + NewtypeUnit(()), NewtypeNewtype(Newtype), NewtypeMap(BTreeMap), NewtypeStruct(Struct), @@ -162,7 +163,13 @@ fn wrong_tag() { Token::Str("Z"), Token::MapEnd, ], - "unknown variant `Z`, expected one of `Unit`, `NewtypeNewtype`, `NewtypeMap`, `NewtypeStruct`, `Struct`", + "unknown variant `Z`, expected one of \ + `Unit`, \ + `NewtypeUnit`, \ + `NewtypeNewtype`, \ + `NewtypeMap`, \ + `NewtypeStruct`, \ + `Struct`", ); } @@ -742,18 +749,14 @@ fn containing_flatten() { #[test] fn newtype_variant_containing_unit() { - #[derive(Debug, PartialEq, Serialize, Deserialize)] - #[serde(tag = "tag")] - enum Data { - A(()), - } + let value = InternallyTagged::NewtypeUnit(()); assert_tokens( - &Data::A(()), + &value, &[ Token::Map { len: Some(1) }, Token::Str("tag"), - Token::Str("A"), + Token::Str("NewtypeUnit"), Token::MapEnd, ], );