Add tests for serde(other) in enum

This commit is contained in:
roblabla 2018-09-10 16:25:02 +00:00
parent 8cc7e6aa90
commit 7870b58356

View File

@ -135,6 +135,13 @@ enum EnumSkipAll {
Skipped,
}
#[derive(PartialEq, Debug, Deserialize)]
enum EnumOther {
Unit,
#[serde(other)]
Other
}
//////////////////////////////////////////////////////////////////////////
macro_rules! declare_tests {
@ -753,6 +760,20 @@ declare_tests! {
Token::Unit,
],
}
test_enum_other_unit {
EnumOther::Unit => &[
Token::Enum { name: "EnumOther" },
Token::Str("Unit"),
Token::Unit,
],
}
test_enum_other {
EnumOther::Other => &[
Token::Enum { name: "EnumOther" },
Token::Str("Foo"),
Token::Unit,
],
}
test_box {
Box::new(0i32) => &[Token::I32(0)],
}