22// SPDX-FileCopyrightText: Copyright the Vortex contributors
33
44use vortex_dtype:: { DType , Nullability , PType } ;
5- use vortex_error:: { VortexExpect as _, VortexUnwrap } ;
5+ use vortex_error:: { VortexExpect as _, VortexUnwrap , vortex_panic } ;
66use vortex_scalar:: Scalar ;
77
88use crate :: Array ;
@@ -120,10 +120,12 @@ fn test_cast_to_non_nullable(array: &dyn Array) {
120120 }
121121 cast ( array, & array. dtype ( ) . as_nonnullable ( ) )
122122 . err ( )
123- . vortex_expect ( & format ! (
124- "arrays with nulls should error when casting to non-nullable {}" ,
125- array,
126- ) ) ;
123+ . unwrap_or_else ( || {
124+ vortex_panic ! (
125+ "arrays with nulls should error when casting to non-nullable {}" ,
126+ array,
127+ )
128+ } ) ;
127129 }
128130}
129131
@@ -190,14 +192,16 @@ fn test_cast_to_primitive(array: &dyn Array, target_ptype: PType, test_round_tri
190192 & DType :: Primitive ( target_ptype, array. dtype ( ) . nullability ( ) ) ,
191193 )
192194 . err ( )
193- . vortex_expect ( & format ! (
194- "Cast must fail because some values are out of bounds. {} {:?} {:?} {} {}" ,
195- target_ptype,
196- min,
197- max,
198- array,
199- array. display_values( ) ,
200- ) ) ;
195+ . unwrap_or_else ( || {
196+ vortex_panic ! (
197+ "Cast must fail because some values are out of bounds. {} {:?} {:?} {} {}" ,
198+ target_ptype,
199+ min,
200+ max,
201+ array,
202+ array. display_values( ) ,
203+ )
204+ } ) ;
201205 return ;
202206 }
203207
@@ -206,11 +210,13 @@ fn test_cast_to_primitive(array: &dyn Array, target_ptype: PType, test_round_tri
206210 array,
207211 & DType :: Primitive ( target_ptype, array. dtype ( ) . nullability ( ) ) ,
208212 )
209- . vortex_expect ( & format ! (
210- "Cast must succeed because all values are within bounds. {} {}" ,
211- target_ptype,
212- array. display_values( ) ,
213- ) ) ;
213+ . unwrap_or_else ( |e| {
214+ vortex_panic ! (
215+ "Cast must succeed because all values are within bounds. {} {}: {e}" ,
216+ target_ptype,
217+ array. display_values( ) ,
218+ )
219+ } ) ;
214220 assert_eq ! ( array. validity_mask( ) , casted. validity_mask( ) ) ;
215221 for i in 0 ..array. len ( ) . min ( 10 ) {
216222 let original = array. scalar_at ( i) ;
0 commit comments