Reuse AdjacentlyTagged enum in bytes
test
Change 0i32 to 1u8 so the test can be merged with the previous in the next commit
This commit is contained in:
parent
df07751e6f
commit
42e63ff942
@ -349,51 +349,51 @@ fn struct_() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn bytes() {
|
fn bytes() {
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Debug)]
|
let value = AdjacentlyTagged::Struct::<u8> { f: 1 };
|
||||||
#[serde(tag = "t", content = "c")]
|
|
||||||
enum Data {
|
|
||||||
A { a: i32 },
|
|
||||||
}
|
|
||||||
|
|
||||||
let data = Data::A { a: 0 };
|
|
||||||
|
|
||||||
assert_tokens(
|
assert_tokens(
|
||||||
&data,
|
&value,
|
||||||
&[
|
&[
|
||||||
Token::Struct {
|
Token::Struct {
|
||||||
name: "Data",
|
name: "AdjacentlyTagged",
|
||||||
len: 2,
|
len: 2,
|
||||||
},
|
},
|
||||||
Token::Str("t"),
|
Token::Str("t"),
|
||||||
Token::UnitVariant {
|
Token::UnitVariant {
|
||||||
name: "Data",
|
name: "AdjacentlyTagged",
|
||||||
variant: "A",
|
variant: "Struct",
|
||||||
},
|
},
|
||||||
Token::Str("c"),
|
Token::Str("c"),
|
||||||
Token::Struct { name: "A", len: 1 },
|
Token::Struct {
|
||||||
Token::Str("a"),
|
name: "Struct",
|
||||||
Token::I32(0),
|
len: 1,
|
||||||
|
},
|
||||||
|
Token::Str("f"),
|
||||||
|
Token::U8(1),
|
||||||
Token::StructEnd,
|
Token::StructEnd,
|
||||||
Token::StructEnd,
|
Token::StructEnd,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_de_tokens(
|
assert_de_tokens(
|
||||||
&data,
|
&value,
|
||||||
&[
|
&[
|
||||||
Token::Struct {
|
Token::Struct {
|
||||||
name: "Data",
|
name: "AdjacentlyTagged",
|
||||||
len: 2,
|
len: 2,
|
||||||
},
|
},
|
||||||
Token::Bytes(b"t"),
|
Token::Bytes(b"t"),
|
||||||
Token::UnitVariant {
|
Token::UnitVariant {
|
||||||
name: "Data",
|
name: "AdjacentlyTagged",
|
||||||
variant: "A",
|
variant: "Struct",
|
||||||
},
|
},
|
||||||
Token::Bytes(b"c"),
|
Token::Bytes(b"c"),
|
||||||
Token::Struct { name: "A", len: 1 },
|
Token::Struct {
|
||||||
Token::Str("a"),
|
name: "Struct",
|
||||||
Token::I32(0),
|
len: 1,
|
||||||
|
},
|
||||||
|
Token::Str("f"),
|
||||||
|
Token::U8(1),
|
||||||
Token::StructEnd,
|
Token::StructEnd,
|
||||||
Token::StructEnd,
|
Token::StructEnd,
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user