diff --git a/test_suite/tests/test_de.rs b/test_suite/tests/test_de.rs index ab7b112e..552e58cb 100644 --- a/test_suite/tests/test_de.rs +++ b/test_suite/tests/test_de.rs @@ -1068,4 +1068,115 @@ declare_error_tests! { ], Error::Message("nul byte found in provided data at position: 2".into()), } + test_unit_from_empty_seq<()> { + &[ + Token::SeqStart(Some(0)), + Token::SeqEnd, + ], + Error::Message("invalid type: sequence, expected unit".into()), + } + test_unit_from_empty_seq_without_len<()> { + &[ + Token::SeqStart(None), + Token::SeqEnd, + ], + Error::Message("invalid type: sequence, expected unit".into()), + } + test_unit_from_tuple_struct<()> { + &[ + Token::TupleStructStart("Anything", 0), + Token::TupleStructEnd, + ], + Error::Message("invalid type: sequence, expected unit".into()), + } + test_string_from_unit { + &[ + Token::Unit, + ], + Error::Message("invalid type: unit value, expected a string".into()), + } + test_btreeset_from_unit> { + &[ + Token::Unit, + ], + Error::Message("invalid type: unit value, expected a sequence".into()), + } + test_btreeset_from_unit_struct> { + &[ + Token::UnitStruct("Anything"), + ], + Error::Message("invalid type: unit value, expected a sequence".into()), + } + test_hashset_from_unit> { + &[ + Token::Unit, + ], + Error::Message("invalid type: unit value, expected a sequence".into()), + } + test_hashset_from_unit_struct> { + &[ + Token::UnitStruct("Anything"), + ], + Error::Message("invalid type: unit value, expected a sequence".into()), + } + test_vec_from_unit> { + &[ + Token::Unit, + ], + Error::Message("invalid type: unit value, expected a sequence".into()), + } + test_vec_from_unit_struct> { + &[ + Token::UnitStruct("Anything"), + ], + Error::Message("invalid type: unit value, expected a sequence".into()), + } + test_zero_array_from_unit<[isize; 0]> { + &[ + Token::Unit, + ], + Error::Message("invalid type: unit value, expected an empty array".into()), + } + test_zero_array_from_unit_struct<[isize; 0]> { + &[ + Token::UnitStruct("Anything"), + ], + Error::Message("invalid type: unit value, expected an empty array".into()), + } + test_btreemap_from_unit> { + &[ + Token::Unit, + ], + Error::Message("invalid type: unit value, expected a map".into()), + } + test_btreemap_from_unit_struct> { + &[ + Token::UnitStruct("Anything"), + ], + Error::Message("invalid type: unit value, expected a map".into()), + } + test_hashmap_from_unit> { + &[ + Token::Unit, + ], + Error::Message("invalid type: unit value, expected a map".into()), + } + test_hashmap_from_unit_struct> { + &[ + Token::UnitStruct("Anything"), + ], + Error::Message("invalid type: unit value, expected a map".into()), + } + test_bool_from_string { + &[ + Token::Str("false"), + ], + Error::Message("invalid type: string \"false\", expected a boolean".into()), + } + test_number_from_string { + &[ + Token::Str("1"), + ], + Error::Message("invalid type: string \"1\", expected isize".into()), + } }