Skip to content
Myr

Add additional checks for unit and newtype_unit tests

Before adoption: this commit came in with the history the project adopted, so no landing records it.

- check that unit variant can be deserialized from a map - check that newtype variant with unit can be deserialized from a struct

authored by Mingun · committed by Mingun · parent 71ed1f2 · Browse files · 1 file+44 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+44 added−0 removed

  • tests:+44 added−0 removed

1 file+44 added−0 removed

modified:test_suite/tests/test_enum_internally_tagged.rs+44 added
74 unmodified lines
7576 assert_de_tokens(77 &InternallyTagged::Unit,78 &[79 Token::Map { len: Some(1) },80 Token::Str("tag"),81 Token::Str("Unit"),82 Token::MapEnd,83 ],84 );85 assert_de_tokens(86 &InternallyTagged::Unit,87 &[88 Token::Map { len: Some(1) },89 Token::BorrowedStr("tag"),90 Token::BorrowedStr("Unit"),91 Token::MapEnd,92 ],93 );9495 assert_de_tokens(96 &InternallyTagged::Unit,97 &[98 Token::Seq { len: Some(1) },99 Token::Str("Unit"), // tag100 Token::SeqEnd,101 ],
29 unmodified lines
131 Token::BorrowedStr("NewtypeUnit"),132 Token::MapEnd,133 ],134 );135136 assert_de_tokens(137 &value,138 &[139 Token::Struct {140 name: "InternallyTagged",141 len: 1,142 },143 Token::Str("tag"),144 Token::Str("NewtypeUnit"),145 Token::StructEnd,146 ],147 );148 assert_de_tokens(149 &value,150 &[151 Token::Struct {152 name: "InternallyTagged",153 len: 1,154 },155 Token::BorrowedStr("tag"),156 Token::BorrowedStr("NewtypeUnit"),157 Token::StructEnd,158 ],159 );160}161162#[test]163fn newtype_unit_struct() {
1315 unmodified lines