diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs index 613efc8..f36abaa 100644 --- a/tests/test_bytes.rs +++ b/tests/test_bytes.rs @@ -157,6 +157,13 @@ fn slice_oob_2() { a.slice(44..49); } +#[test] +#[should_panic] +fn slice_start_greater_than_end() { + let a = Bytes::from(&b"hello world"[..]); + a.slice(5..3); +} + #[test] fn split_off() { let mut hello = Bytes::from(&b"helloworld"[..]); @@ -724,6 +731,15 @@ fn advance_past_len() { a.advance(20); } +#[test] +#[should_panic] +fn mut_advance_past_len() { + let mut a = BytesMut::from("hello world"); + unsafe { + a.advance_mut(20); + } +} + #[test] // Only run these tests on little endian systems. CI uses qemu for testing // big endian... and qemu doesn't really support threading all that well.