Convert newtype_enum and struct_enum tests into modules
Separate testing each variant kind of enum (unit, newtype, tuple, struct) results in more specific information if that checks fail (review this commit with "ignore whitespace changes" option on)
This commit is contained in:
parent
8bfe0d0ac0
commit
4987fd15f7
@ -187,8 +187,11 @@ fn newtype_struct() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn newtype_enum() {
|
||||
mod newtype_enum {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn unit() {
|
||||
assert_tokens(
|
||||
&InternallyTagged::NewtypeEnum(Enum::Unit),
|
||||
&[
|
||||
@ -200,7 +203,10 @@ fn newtype_enum() {
|
||||
Token::MapEnd,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn newtype() {
|
||||
assert_tokens(
|
||||
&InternallyTagged::NewtypeEnum(Enum::Newtype(1)),
|
||||
&[
|
||||
@ -212,7 +218,10 @@ fn newtype_enum() {
|
||||
Token::MapEnd,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tuple() {
|
||||
// Reaches crate::private::de::content::VariantDeserializer::tuple_variant
|
||||
// Content::Seq case
|
||||
// via ContentDeserializer::deserialize_enum
|
||||
@ -233,7 +242,10 @@ fn newtype_enum() {
|
||||
Token::MapEnd,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn struct_() {
|
||||
// Reaches crate::private::de::content::VariantDeserializer::struct_variant
|
||||
// Content::Map case
|
||||
// via ContentDeserializer::deserialize_enum
|
||||
@ -271,6 +283,7 @@ fn newtype_enum() {
|
||||
Token::MapEnd,
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -301,8 +314,11 @@ fn struct_() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn struct_enum() {
|
||||
mod struct_enum {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn unit() {
|
||||
assert_de_tokens(
|
||||
&Enum::Unit,
|
||||
&[
|
||||
@ -356,6 +372,7 @@ fn struct_enum() {
|
||||
Token::SeqEnd,
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
Reference in New Issue
Block a user