File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,32 @@ fn copying() {
7575 }
7676}
7777
78+ // regression tests for #236
79+ #[ test]
80+ fn copy_within_supports_empty_ranges ( ) {
81+ let empty = bits ! [ mut u8 , Lsb0 ; 0 ; 0 ] ;
82+ empty. copy_within ( 0 ..0 , 0 ) ;
83+ assert_eq ! ( empty, bits![ ] ) ;
84+
85+ let non_empty = bits ! [ mut u8 , Lsb0 ; 0 ; 3 ] ;
86+ non_empty. copy_within ( 2 ..2 , 0 ) ;
87+ assert_eq ! ( non_empty, bits![ 0 , 0 , 0 ] ) ;
88+ }
89+ #[ test]
90+ #[ should_panic]
91+ fn copy_within_panics_if_empty_range_exceeds_bounds ( ) {
92+ let empty_slice = bits ! [ mut u8 , Lsb0 ; 0 ; 0 ] ;
93+ empty_slice. copy_within ( 2 ..2 , 0 ) ;
94+ }
95+ #[ test]
96+ #[ should_panic]
97+ fn copy_within_panics_if_dest_for_empty_range_exceeds_bounds ( ) {
98+ let empty_slice = bits ! [ mut u8 , Lsb0 ; 0 ; 0 ] ;
99+ empty_slice. copy_within ( 0 ..0 , 1 ) ;
100+ }
101+
102+
103+
78104#[ test]
79105fn writing ( ) {
80106 let bits = bits ! [ mut 0 ; 2 ] ;
You can’t perform that action at this time.
0 commit comments