@@ -718,12 +718,37 @@ fn allow_max_capacity_arrayvec_type() {
718
718
let _v: ArrayVec < ( ) , { usize:: MAX } > ;
719
719
}
720
720
721
- #[ should_panic( expected="ArrayVec: largest supported " ) ]
721
+ #[ should_panic( expected="index out of bounds " ) ]
722
722
#[ test]
723
723
fn deny_max_capacity_arrayvec_value ( ) {
724
724
if mem:: size_of :: < usize > ( ) <= mem:: size_of :: < u32 > ( ) {
725
- panic ! ( "This test does not work on this platform. 'ArrayVec: largest supported '" ) ;
725
+ panic ! ( "This test does not work on this platform. 'index out of bounds '" ) ;
726
726
}
727
727
// this type is allowed to be used (but can't be constructed)
728
728
let _v: ArrayVec < ( ) , { usize:: MAX } > = ArrayVec :: new ( ) ;
729
729
}
730
+
731
+ #[ test]
732
+ fn test_arrayvec_const_constructible ( ) {
733
+ const OF_U8 : ArrayVec < Vec < u8 > , 10 > = ArrayVec :: new ( ) ;
734
+
735
+ let mut var = OF_U8 ;
736
+ assert ! ( var. is_empty( ) ) ;
737
+ assert_eq ! ( var, ArrayVec :: new( ) ) ;
738
+ var. push ( vec ! [ 3 , 5 , 8 ] ) ;
739
+ assert_eq ! ( var[ ..] , [ vec![ 3 , 5 , 8 ] ] ) ;
740
+ }
741
+
742
+
743
+ #[ test]
744
+ fn test_arraystring_const_constructible ( ) {
745
+ const AS : ArrayString < 10 > = ArrayString :: new ( ) ;
746
+
747
+ let mut var = AS ;
748
+ assert ! ( var. is_empty( ) ) ;
749
+ assert_eq ! ( var, ArrayString :: new( ) ) ;
750
+ var. push_str ( "hello" ) ;
751
+ assert_eq ! ( var, * "hello" ) ;
752
+ }
753
+
754
+
0 commit comments