mirror of
https://github.com/Lokathor/bytemuck.git
synced 2024-11-21 06:12:23 +00:00
Fix box_bytes_zst test (#260)
This commit is contained in:
parent
20f4a09404
commit
e1baf85f09
@ -357,9 +357,15 @@ fn box_bytes_zst() {
|
||||
let _: Box<[u8]> = from_box_bytes(x);
|
||||
|
||||
let x: BoxBytes = box_bytes_of(Box::new([0u8; 0]));
|
||||
let res: Result<Box<[()]>, _> = try_from_box_bytes(x);
|
||||
assert_eq!(res.unwrap_err().0, PodCastError::SizeMismatch);
|
||||
let _: Box<[()]> = from_box_bytes(x);
|
||||
|
||||
let x: BoxBytes = box_bytes_of(Box::new([(); 0]));
|
||||
let _: Box<[u8]> = from_box_bytes(x);
|
||||
|
||||
let x: BoxBytes = box_bytes_of(Box::new([0u8]));
|
||||
let res: Result<Box<[()]>, _> = try_from_box_bytes(x);
|
||||
assert_eq!(res.unwrap_err().0, PodCastError::OutputSliceWouldHaveSlop);
|
||||
|
||||
// regression test for dropping zero-sized BoxBytes
|
||||
let _: BoxBytes = box_bytes_of(Box::new([0u8; 0]));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user