@@ -30,39 +30,27 @@ macro_rules! _parse_ignore {
3030#[ allow( clippy:: crate_in_macro_def) ] // accessing item defined by `_main_parse`
3131macro_rules! _test_parse {
3232 ( #[ test] $( #[ $( $attr: tt) * ] ) * fn $name: ident $( $item: tt) * ) => {
33- #[ allow( non_camel_case_types) ]
34- struct $name;
35-
36- impl $crate:: Case for $name {
37- fn name( & self ) -> & str {
38- $crate:: _private:: push!( crate :: TESTS , _: $crate:: _private:: DynCase = $crate:: _private:: DynCase ( & $name) ) ;
39-
40- stringify!( $name)
41- }
42- fn kind( & self ) -> $crate:: _private:: TestKind {
43- Default :: default ( )
44- }
45- fn source( & self ) -> Option <& $crate:: _private:: Source > {
46- None
47- }
48- fn exclusive( & self , _: & $crate:: TestContext ) -> bool {
49- false
50- }
51-
52- fn run( & self , context: & $crate:: TestContext ) -> $crate:: RunResult {
53- fn run $( $item) *
54-
55- $(
56- match $crate:: _private:: parse_ignore!( $( $attr) * ) {
57- :: std:: option:: Option :: None => context. ignore( ) ?,
58- :: std:: option:: Option :: Some ( reason) => context. ignore_for( reason) ?,
33+ const _: ( ) = {
34+ $crate:: _private:: push!(
35+ crate :: TESTS ,
36+ _: $crate:: _private:: DynCase = $crate:: _private:: DynCase ( & $crate:: FnCase :: test(
37+ :: std:: borrow:: Cow :: Borrowed ( stringify!( $name) ) ,
38+ |context| {
39+ $(
40+ match $crate:: _private:: parse_ignore!( $( $attr) * ) {
41+ :: std:: option:: Option :: None => context. ignore( ) ?,
42+ :: std:: option:: Option :: Some ( reason) => context. ignore_for( reason) ?,
43+ }
44+ ) *
45+
46+ use $crate:: IntoRunResult ;
47+ let result = $name( context) ;
48+ IntoRunResult :: into_run_result( result)
5949 }
60- ) *
50+ ) )
51+ ) ;
52+ } ;
6153
62- use $crate:: IntoRunResult ;
63- let result = run( context) ;
64- IntoRunResult :: into_run_result( result)
65- }
66- }
54+ fn $name $( $item) *
6755 } ;
6856}
0 commit comments