Skip to content

Commit fc29d43

Browse files
briansmithjosephlr
authored andcommitted
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 rust-random#298.
1 parent c1fbd0d commit fc29d43

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

tests/custom.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ fn len7_err() -> Error {
1616
}
1717

1818
fn super_insecure_rng(buf: &mut [u8]) -> Result<(), Error> {
19+
// `getrandom` guarantees it will not call any implementation if the output
20+
// buffer is empty.
21+
assert!(!buf.is_empty());
1922
// Length 7 buffers return a custom error
2023
if buf.len() == 7 {
2124
return Err(len7_err());

0 commit comments

Comments
 (0)