File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ extern crate arrayvec;
3
3
4
4
use arrayvec:: ArrayVec ;
5
5
use arrayvec:: ArrayString ;
6
+ use arrayvec:: ArrayVecCopy ;
6
7
use std:: mem;
7
8
use arrayvec:: CapacityError ;
8
9
@@ -774,3 +775,23 @@ fn test_arraystring_zero_filled_has_some_sanity_checks() {
774
775
assert_eq ! ( string. as_str( ) , "\0 \0 \0 \0 " ) ;
775
776
assert_eq ! ( string. len( ) , 4 ) ;
776
777
}
778
+
779
+ #[ test]
780
+ fn test_arrayvec_copy_is_copy ( ) {
781
+ let mut vec: ArrayVecCopy < usize , 10 > = ArrayVecCopy :: new ( ) ;
782
+
783
+ vec. try_extend_from_slice ( & [ 1 , 2 , 3 ] ) . unwrap ( ) ;
784
+ assert_eq ! ( vec. len( ) , 3 ) ;
785
+ assert_eq ! ( & vec[ ..] , & [ 1 , 2 , 3 ] ) ;
786
+
787
+ let copy = vec;
788
+
789
+ assert_eq ! ( & copy[ ..] , & vec[ ..] ) ;
790
+
791
+ let many_duplicates = [ copy; 16 ] ;
792
+
793
+ // deref to copy in pattern
794
+ for & dup in & many_duplicates {
795
+ assert_eq ! ( dup, vec) ;
796
+ }
797
+ }
You can’t perform that action at this time.
0 commit comments