diff --git a/zerocopy-derive/tests/enum_from_zeros.rs b/zerocopy-derive/tests/enum_from_zeros.rs index df64e4d240..abe30dcb74 100644 --- a/zerocopy-derive/tests/enum_from_zeros.rs +++ b/zerocopy-derive/tests/enum_from_zeros.rs @@ -36,3 +36,12 @@ enum Baz { } assert_impl_all!(Baz: FromZeros); + +#[derive(FromZeros)] +#[repr(C)] +enum Bat { + A(u32), + B { foo: u32 }, +} + +assert_impl_all!(Bat: FromZeros); diff --git a/zerocopy-derive/tests/enum_try_from_bytes.rs b/zerocopy-derive/tests/enum_try_from_bytes.rs index 3a9b24223c..ead433ede6 100644 --- a/zerocopy-derive/tests/enum_try_from_bytes.rs +++ b/zerocopy-derive/tests/enum_try_from_bytes.rs @@ -158,4 +158,6 @@ fn test_has_fields() { const SIZE: usize = core::mem::size_of::(); let bytes: [u8; SIZE] = zerocopy::transmute!(HasFields::B(10)); assert_eq!(HasFields::try_read_from(&bytes[..]), Some(HasFields::B(10))); + let bytes: [u8; SIZE] = zerocopy::transmute!(HasFields::C { foo: 10 }); + assert_eq!(HasFields::try_read_from(&bytes[..]), Some(HasFields::C { foo: 10 })); }