Skip to content

Commit dd850e2

Browse files
authored
Add tests for Zeroize impl (#211)
1 parent eddb29c commit dd850e2

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/mod.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,12 +518,22 @@ mod allocating {
518518
}
519519
}
520520

521-
#[test]
522521
#[cfg(feature = "zerocopy")]
522+
#[test]
523523
#[allow(unused)]
524524
fn zerocopy_traits() {
525525
use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout, Unaligned};
526526
struct Check<T: IntoBytes + FromBytes + Unaligned + Immutable + KnownLayout>(T);
527527
let ok: Check<Array<u8, U5>> = Check(Array([1, 2, 3, 4, 5]));
528528
// let not_unaligned: Check::<Array<u16, U5>> = Check(Array([1, 2, 3, 4, 5]));
529529
}
530+
531+
#[cfg(feature = "zeroize")]
532+
#[test]
533+
fn zeroize_array() {
534+
use zeroize::Zeroize;
535+
536+
let mut array: Array<u8, U3> = Array([1, 2, 3]);
537+
array.zeroize();
538+
assert_eq!(&array, &[0, 0, 0]);
539+
}

0 commit comments

Comments
 (0)