Group newtype and newtype_with_newtype tests
This commit is contained in:
parent
5445f1741b
commit
df07751e6f
@ -216,6 +216,33 @@ fn newtype() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn newtype_with_newtype() {
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
struct NewtypeStruct(u32);
|
||||
|
||||
assert_de_tokens(
|
||||
&AdjacentlyTagged::Newtype(NewtypeStruct(5)),
|
||||
&[
|
||||
Token::Struct {
|
||||
name: "AdjacentlyTagged",
|
||||
len: 2,
|
||||
},
|
||||
Token::Str("c"),
|
||||
Token::NewtypeStruct {
|
||||
name: "NewtypeStruct",
|
||||
},
|
||||
Token::U32(5),
|
||||
Token::Str("t"),
|
||||
Token::UnitVariant {
|
||||
name: "AdjacentlyTagged",
|
||||
variant: "Newtype",
|
||||
},
|
||||
Token::StructEnd,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tuple() {
|
||||
let value = AdjacentlyTagged::Tuple::<u8>(1, 1);
|
||||
@ -477,33 +504,6 @@ fn partially_untagged() {
|
||||
// TODO test error output
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn newtype_with_newtype() {
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
struct NewtypeStruct(u32);
|
||||
|
||||
assert_de_tokens(
|
||||
&AdjacentlyTagged::Newtype(NewtypeStruct(5)),
|
||||
&[
|
||||
Token::Struct {
|
||||
name: "AdjacentlyTagged",
|
||||
len: 2,
|
||||
},
|
||||
Token::Str("c"),
|
||||
Token::NewtypeStruct {
|
||||
name: "NewtypeStruct",
|
||||
},
|
||||
Token::U32(5),
|
||||
Token::Str("t"),
|
||||
Token::UnitVariant {
|
||||
name: "AdjacentlyTagged",
|
||||
variant: "Newtype",
|
||||
},
|
||||
Token::StructEnd,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn deny_unknown_fields() {
|
||||
#[derive(Debug, PartialEq, Deserialize)]
|
||||
|
Loading…
Reference in New Issue
Block a user