44#![ allow( clippy:: integer_arithmetic) ]
55
66use crate :: { utils, Result } ;
7- use libtest_mimic:: { run_tests , Arguments , Outcome , Test } ;
7+ use libtest_mimic:: { Arguments , Trial } ;
88use std:: path:: Path ;
99
1010#[ doc( hidden) ]
1111pub fn runner ( requirements : & [ Requirements ] ) {
1212 let args = Arguments :: from_args ( ) ;
1313
1414 let mut tests: Vec < _ > = requirements. iter ( ) . flat_map ( |req| req. expand ( ) ) . collect ( ) ;
15- tests. sort_unstable_by ( |a, b| a. name . cmp ( & b. name ) ) ;
15+ tests. sort_unstable_by ( |a, b| a. name ( ) . cmp ( b. name ( ) ) ) ;
1616
17- run_tests ( & args, tests, |test| ( test . data ) ( ) ) . exit ( )
17+ libtest_mimic :: run ( & args, tests) . exit ( )
1818}
1919
2020#[ doc( hidden) ]
@@ -43,7 +43,7 @@ impl Requirements {
4343
4444 /// Scans all files in a given directory, finds matching ones and generates a test descriptor
4545 /// for each of them.
46- fn expand ( & self ) -> Vec < Test < Box < dyn Fn ( ) -> Outcome + Send + Sync > > > {
46+ fn expand ( & self ) -> Vec < Trial > {
4747 let root = Path :: new ( & self . root ) . to_path_buf ( ) ;
4848
4949 let re = regex:: Regex :: new ( & self . pattern )
@@ -55,21 +55,10 @@ impl Requirements {
5555 if re. is_match ( & input_path) {
5656 let testfn = self . test ;
5757 let name = utils:: derive_test_name ( & root, & path, & self . test_name ) ;
58- let testfn: Box < dyn Fn ( ) -> Outcome + Send + Sync > =
59- Box :: new ( move || match ( testfn) ( & path) {
60- Ok ( ( ) ) => Outcome :: Passed ,
61- Err ( err) => Outcome :: Failed {
62- msg : Some ( format ! ( "{}" , err) ) ,
63- } ,
64- } ) ;
6558
66- Some ( Test {
67- name,
68- kind : String :: new ( ) ,
69- is_ignored : false ,
70- is_bench : false ,
71- data : testfn,
72- } )
59+ Some ( Trial :: test ( name, move || {
60+ ( testfn) ( & path) . map_err ( Into :: into)
61+ } ) )
7362 } else {
7463 None
7564 }
0 commit comments