Convert test_internally_tagged_enum into module
(review this commit with "ignore whitespace changes" option on)
This commit is contained in:
parent
af376c22c3
commit
aa0654332d
@ -679,8 +679,9 @@ fn test_untagged_enum() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_internally_tagged_enum() {
|
||||
mod internally_tagged_enum {
|
||||
use super::*;
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
struct Newtype(BTreeMap<String, String>);
|
||||
|
||||
@ -699,6 +700,8 @@ fn test_internally_tagged_enum() {
|
||||
E(Struct),
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn struct_() {
|
||||
assert_tokens(
|
||||
&InternallyTagged::A { a: 1 },
|
||||
&[
|
||||
@ -723,7 +726,10 @@ fn test_internally_tagged_enum() {
|
||||
Token::SeqEnd,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unit() {
|
||||
assert_tokens(
|
||||
&InternallyTagged::B,
|
||||
&[
|
||||
@ -741,7 +747,10 @@ fn test_internally_tagged_enum() {
|
||||
&InternallyTagged::B,
|
||||
&[Token::Seq { len: Some(1) }, Token::Str("B"), Token::SeqEnd],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn newtype_map() {
|
||||
assert_tokens(
|
||||
&InternallyTagged::C(BTreeMap::new()),
|
||||
&[
|
||||
@ -762,7 +771,10 @@ fn test_internally_tagged_enum() {
|
||||
],
|
||||
"invalid type: sequence, expected a map",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn newtype_newtype() {
|
||||
assert_tokens(
|
||||
&InternallyTagged::D(Newtype(BTreeMap::new())),
|
||||
&[
|
||||
@ -772,7 +784,10 @@ fn test_internally_tagged_enum() {
|
||||
Token::MapEnd,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn newtype_struct() {
|
||||
assert_tokens(
|
||||
&InternallyTagged::E(Struct { f: 6 }),
|
||||
&[
|
||||
@ -797,7 +812,10 @@ fn test_internally_tagged_enum() {
|
||||
Token::SeqEnd,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn wrong_tag() {
|
||||
assert_de_tokens_error::<InternallyTagged>(
|
||||
&[Token::Map { len: Some(0) }, Token::MapEnd],
|
||||
"missing field `type`",
|
||||
@ -813,6 +831,7 @@ fn test_internally_tagged_enum() {
|
||||
"unknown variant `Z`, expected one of `A`, `B`, `C`, `D`, `E`",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_internally_tagged_enum_with_untagged_variant() {
|
||||
|
Loading…
Reference in New Issue
Block a user