File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff 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]
161168fn 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.
You can’t perform that action at this time.
0 commit comments