mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-10-26 21:39:53 +00:00
Bug fix for #1449
Modified serialize_struct_as_struct. Added test test_internally_tagged_braced_struct_with_zero_fields
This commit is contained in:
1 parent
2359417804
commit
889e17816f
2 files changed
+22
-1
No files matched your search
@@ -1413,6 +1413,26 @@ fn test_internally_tagged_struct() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_internally_tagged_braced_struct_with_zero_fields() {
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(tag = "type")]
|
||||
struct S {}
|
||||
|
||||
assert_tokens(
|
||||
&S{ },
|
||||
&[
|
||||
Token::Struct {
|
||||
name: "S",
|
||||
len: 1,
|
||||
},
|
||||
Token::Str("type"),
|
||||
Token::Str("S"),
|
||||
Token::StructEnd,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_enum_in_untagged_enum() {
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
|
||||
Reference in new issue
Block a user