@@ -342,80 +342,54 @@ variadics_please::all_tuples!(impl_through_typed_tuple, 0, 13, T);
342342mod test {
343343 use super :: * ;
344344
345- fn assert_type_info_is_through < T : Typed + TypedThrough > ( ) {
345+ fn assert_type_info_is_primitive < T : Typed + TypedThrough > ( kind : ReflectionPrimitiveKind ) {
346346 let type_info = T :: type_info ( ) ;
347347 let through_type_info = T :: through_type_info ( ) ;
348-
349- match through_type_info {
350- ThroughTypeInfo :: TypeInfo ( info) => {
351- assert_eq ! ( info. type_id( ) , type_info. type_id( ) ) ;
352- assert_eq ! ( info. type_path( ) , type_info. type_path( ) ) ;
353- }
354- _ => panic ! ( "Expected ThroughTypeInfo::TypeInfo" ) ,
355- }
356- }
357-
358- fn assert_dynamic_through_type_is_val_info < T : Typed + TypedThrough > ( ) {
359- let type_info = T :: type_info ( ) ;
360- let through_type_info = into_through_type_info ( type_info) ;
361-
362- match through_type_info {
363- ThroughTypeInfo :: UntypedWrapper {
364- through_type,
365- wrapper_kind,
366- } => {
367- assert_eq ! ( wrapper_kind, UntypedWrapperKind :: Val ) ;
368- assert_eq ! ( through_type. type_id( ) , type_info. type_id( ) ) ;
369- assert_eq ! ( through_type. type_path( ) , type_info. type_path( ) ) ;
348+ let dynamic_through_type_info = into_through_type_info ( type_info) ;
349+
350+ for ( test, info) in [
351+ ( "static" , through_type_info) ,
352+ ( "dynamic" , dynamic_through_type_info) ,
353+ ] {
354+ match info {
355+ ThroughTypeInfo :: Primitive ( prim) => {
356+ assert_eq ! (
357+ prim,
358+ kind,
359+ "expected {} to have primitive {test} type info: {kind}" ,
360+ std:: any:: type_name:: <T >( )
361+ )
362+ }
363+ _ => panic ! ( "Expected ThroughTypeInfo::TypeInfo" ) ,
370364 }
371- _ => panic ! ( "Expected ThroughTypeInfo::TypeInfo" ) ,
372365 }
373366 }
374367
375368 #[ test]
376369 fn test_typed_through_primitives ( ) {
377- assert_type_info_is_through :: < bool > ( ) ;
378- assert_dynamic_through_type_is_val_info :: < bool > ( ) ;
379- assert_type_info_is_through :: < i8 > ( ) ;
380- assert_dynamic_through_type_is_val_info :: < i8 > ( ) ;
381- assert_type_info_is_through :: < i16 > ( ) ;
382- assert_dynamic_through_type_is_val_info :: < i16 > ( ) ;
383- assert_type_info_is_through :: < i32 > ( ) ;
384- assert_dynamic_through_type_is_val_info :: < i32 > ( ) ;
385- assert_type_info_is_through :: < i64 > ( ) ;
386- assert_dynamic_through_type_is_val_info :: < i64 > ( ) ;
387- assert_type_info_is_through :: < i128 > ( ) ;
388- assert_dynamic_through_type_is_val_info :: < i128 > ( ) ;
389- assert_type_info_is_through :: < u8 > ( ) ;
390- assert_dynamic_through_type_is_val_info :: < u8 > ( ) ;
391- assert_type_info_is_through :: < u16 > ( ) ;
392- assert_dynamic_through_type_is_val_info :: < u16 > ( ) ;
393- assert_type_info_is_through :: < u32 > ( ) ;
394- assert_dynamic_through_type_is_val_info :: < u32 > ( ) ;
395- assert_type_info_is_through :: < u64 > ( ) ;
396- assert_dynamic_through_type_is_val_info :: < u64 > ( ) ;
397- assert_type_info_is_through :: < u128 > ( ) ;
398- assert_dynamic_through_type_is_val_info :: < u128 > ( ) ;
399- assert_type_info_is_through :: < f32 > ( ) ;
400- assert_dynamic_through_type_is_val_info :: < f32 > ( ) ;
401- assert_type_info_is_through :: < f64 > ( ) ;
402- assert_dynamic_through_type_is_val_info :: < f64 > ( ) ;
403- assert_type_info_is_through :: < usize > ( ) ;
404- assert_dynamic_through_type_is_val_info :: < usize > ( ) ;
405- assert_type_info_is_through :: < isize > ( ) ;
406- assert_dynamic_through_type_is_val_info :: < isize > ( ) ;
407- assert_type_info_is_through :: < String > ( ) ;
408- assert_dynamic_through_type_is_val_info :: < String > ( ) ;
409- assert_type_info_is_through :: < PathBuf > ( ) ;
410- assert_dynamic_through_type_is_val_info :: < PathBuf > ( ) ;
411- assert_type_info_is_through :: < OsString > ( ) ;
412- assert_dynamic_through_type_is_val_info :: < OsString > ( ) ;
413- assert_type_info_is_through :: < char > ( ) ;
414- assert_dynamic_through_type_is_val_info :: < char > ( ) ;
415- assert_type_info_is_through :: < ReflectReference > ( ) ;
416- assert_dynamic_through_type_is_val_info :: < ReflectReference > ( ) ;
417- assert_type_info_is_through :: < & ' static str > ( ) ;
418- assert_dynamic_through_type_is_val_info :: < & ' static str > ( ) ;
370+ assert_type_info_is_primitive :: < bool > ( ReflectionPrimitiveKind :: Bool ) ;
371+ assert_type_info_is_primitive :: < i8 > ( ReflectionPrimitiveKind :: I8 ) ;
372+ assert_type_info_is_primitive :: < i16 > ( ReflectionPrimitiveKind :: I16 ) ;
373+ assert_type_info_is_primitive :: < i32 > ( ReflectionPrimitiveKind :: I32 ) ;
374+ assert_type_info_is_primitive :: < i64 > ( ReflectionPrimitiveKind :: I64 ) ;
375+ assert_type_info_is_primitive :: < i128 > ( ReflectionPrimitiveKind :: I128 ) ;
376+ assert_type_info_is_primitive :: < u8 > ( ReflectionPrimitiveKind :: U8 ) ;
377+ assert_type_info_is_primitive :: < u16 > ( ReflectionPrimitiveKind :: U16 ) ;
378+ assert_type_info_is_primitive :: < u32 > ( ReflectionPrimitiveKind :: U32 ) ;
379+ assert_type_info_is_primitive :: < u64 > ( ReflectionPrimitiveKind :: U64 ) ;
380+ assert_type_info_is_primitive :: < u128 > ( ReflectionPrimitiveKind :: U128 ) ;
381+ assert_type_info_is_primitive :: < f32 > ( ReflectionPrimitiveKind :: F32 ) ;
382+ assert_type_info_is_primitive :: < f64 > ( ReflectionPrimitiveKind :: F64 ) ;
383+ assert_type_info_is_primitive :: < usize > ( ReflectionPrimitiveKind :: Usize ) ;
384+ assert_type_info_is_primitive :: < isize > ( ReflectionPrimitiveKind :: Isize ) ;
385+ assert_type_info_is_primitive :: < String > ( ReflectionPrimitiveKind :: String ) ;
386+ assert_type_info_is_primitive :: < PathBuf > ( ReflectionPrimitiveKind :: PathBuf ) ;
387+ assert_type_info_is_primitive :: < OsString > ( ReflectionPrimitiveKind :: OsString ) ;
388+ assert_type_info_is_primitive :: < char > ( ReflectionPrimitiveKind :: Char ) ;
389+ assert_type_info_is_primitive :: < ReflectReference > (
390+ ReflectionPrimitiveKind :: ReflectReference ,
391+ ) ;
392+ assert_type_info_is_primitive :: < & ' static str > ( ReflectionPrimitiveKind :: Str ) ;
419393 }
420394
421395 #[ test]
0 commit comments