Skip to content

Commit 5c90b11

Browse files
author
AbeZbm
committed
Add missing tests in test_bytes
1 parent 141cbc2 commit 5c90b11

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/test_bytes.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,13 @@ fn slice_oob_2() {
157157
a.slice(44..49);
158158
}
159159

160+
#[test]
161+
#[should_panic]
162+
fn slice_start_greater_than_end() {
163+
let a = Bytes::from(&b"hello world"[..]);
164+
a.slice(5..3);
165+
}
166+
160167
#[test]
161168
fn split_off() {
162169
let mut hello = Bytes::from(&b"helloworld"[..]);
@@ -724,6 +731,15 @@ fn advance_past_len() {
724731
a.advance(20);
725732
}
726733

734+
#[test]
735+
#[should_panic]
736+
fn mut_advance_past_len() {
737+
let mut a = BytesMut::from("hello world");
738+
unsafe {
739+
a.advance_mut(20);
740+
}
741+
}
742+
727743
#[test]
728744
// Only run these tests on little endian systems. CI uses qemu for testing
729745
// big endian... and qemu doesn't really support threading all that well.

0 commit comments

Comments
 (0)