From 8d3ca51729c18cfbb52805264df1632c19abaad8 Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Mon, 6 Apr 2026 09:08:01 -0600 Subject: [PATCH] Add tests for `Zeroize` impl --- tests/mod.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/mod.rs b/tests/mod.rs index b657a23..3fb7ab9 100644 --- a/tests/mod.rs +++ b/tests/mod.rs @@ -518,8 +518,8 @@ mod allocating { } } -#[test] #[cfg(feature = "zerocopy")] +#[test] #[allow(unused)] fn zerocopy_traits() { use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout, Unaligned}; @@ -527,3 +527,13 @@ fn zerocopy_traits() { let ok: Check> = Check(Array([1, 2, 3, 4, 5])); // let not_unaligned: Check::> = Check(Array([1, 2, 3, 4, 5])); } + +#[cfg(feature = "zeroize")] +#[test] +fn zeroize_array() { + use zeroize::Zeroize; + + let mut array: Array = Array([1, 2, 3]); + array.zeroize(); + assert_eq!(&array, &[0, 0, 0]); +}