Split test test_adjacently_tagged_enum into four tests for each variant
(review this commit with "ignore whitespace changes" option on)
This commit is contained in:
parent
5a359e10f4
commit
bee7470715
@ -11,17 +11,17 @@ use serde_test::{
|
|||||||
assert_de_tokens, assert_de_tokens_error, assert_ser_tokens, assert_tokens, Token,
|
assert_de_tokens, assert_de_tokens_error, assert_ser_tokens, assert_tokens, Token,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||||
fn test_adjacently_tagged_enum() {
|
#[serde(tag = "t", content = "c")]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
enum AdjacentlyTagged<T> {
|
||||||
#[serde(tag = "t", content = "c")]
|
Unit,
|
||||||
enum AdjacentlyTagged<T> {
|
Newtype(T),
|
||||||
Unit,
|
Tuple(u8, u8),
|
||||||
Newtype(T),
|
Struct { f: u8 },
|
||||||
Tuple(u8, u8),
|
}
|
||||||
Struct { f: u8 },
|
|
||||||
}
|
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn unit() {
|
||||||
// unit with no content
|
// unit with no content
|
||||||
assert_ser_tokens(
|
assert_ser_tokens(
|
||||||
&AdjacentlyTagged::Unit::<u8>,
|
&AdjacentlyTagged::Unit::<u8>,
|
||||||
@ -118,7 +118,10 @@ fn test_adjacently_tagged_enum() {
|
|||||||
Token::StructEnd,
|
Token::StructEnd,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn newtype() {
|
||||||
// newtype with tag first
|
// newtype with tag first
|
||||||
assert_tokens(
|
assert_tokens(
|
||||||
&AdjacentlyTagged::Newtype::<u8>(1),
|
&AdjacentlyTagged::Newtype::<u8>(1),
|
||||||
@ -211,7 +214,10 @@ fn test_adjacently_tagged_enum() {
|
|||||||
Token::StructEnd,
|
Token::StructEnd,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn tuple() {
|
||||||
// tuple with tag first
|
// tuple with tag first
|
||||||
assert_tokens(
|
assert_tokens(
|
||||||
&AdjacentlyTagged::Tuple::<u8>(1, 1),
|
&AdjacentlyTagged::Tuple::<u8>(1, 1),
|
||||||
@ -255,7 +261,10 @@ fn test_adjacently_tagged_enum() {
|
|||||||
Token::StructEnd,
|
Token::StructEnd,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn struct_() {
|
||||||
// struct with tag first
|
// struct with tag first
|
||||||
assert_tokens(
|
assert_tokens(
|
||||||
&AdjacentlyTagged::Struct::<u8> { f: 1 },
|
&AdjacentlyTagged::Struct::<u8> { f: 1 },
|
||||||
|
Loading…
Reference in New Issue
Block a user