allow Deserialize derive to handle generic unit structs

This commit is contained in:
Baptiste de Montangon
2023-07-10 01:31:40 +02:00
parent 6502838f27
commit 89c8d85de9
2 changed files with 31 additions and 4 deletions
+14
View File
@@ -46,6 +46,9 @@ mod macros;
#[derive(Copy, Clone, PartialEq, Debug, Deserialize)]
struct UnitStruct;
#[derive(Copy, Clone, PartialEq, Debug, Deserialize)]
struct GenericUnitStruct<const N: u8>;
#[derive(PartialEq, Debug, Deserialize)]
struct NewtypeStruct(i32);
@@ -883,6 +886,17 @@ fn test_unit_struct() {
test(UnitStruct, &[Token::UnitStruct { name: "UnitStruct" }]);
}
#[test]
fn test_generic_unit_struct() {
test(GenericUnitStruct::<8>, &[Token::Unit]);
test(
GenericUnitStruct::<8>,
&[Token::UnitStruct {
name: "GenericUnitStruct",
}],
);
}
#[test]
fn test_newtype_struct() {
test(