Skip to content

Commit 302da04

Browse files
committed
Tests: Use custom tests to verify operations on empty slices are no-ops.
Modify the custom tests so that they would have detected and prevented the issue fixed in #298.
1 parent e61f613 commit 302da04

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tests/custom_common/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ pub fn len7_err() -> Error {
1010
}
1111

1212
fn super_insecure_rng(buf: &mut [u8]) -> Result<(), Error> {
13+
// `getrandom` guarantees it will not call any implementation if the output
14+
// buffer is empty.
15+
assert!(!buf.is_empty());
1316
// Length 7 buffers return a custom error
1417
if buf.len() == 7 {
1518
return Err(len7_err());

0 commit comments

Comments
 (0)