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() {
157
157
a. slice ( 44 ..49 ) ;
158
158
}
159
159
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
+
160
167
#[ test]
161
168
fn split_off ( ) {
162
169
let mut hello = Bytes :: from ( & b"helloworld" [ ..] ) ;
@@ -724,6 +731,15 @@ fn advance_past_len() {
724
731
a. advance ( 20 ) ;
725
732
}
726
733
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
+
727
743
#[ test]
728
744
// Only run these tests on little endian systems. CI uses qemu for testing
729
745
// big endian... and qemu doesn't really support threading all that well.
You can’t perform that action at this time.
0 commit comments