File tree Expand file tree Collapse file tree
crates/libtest2-harness/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ pub struct TestContext {
55 pub ( crate ) mode : RunMode ,
66 pub ( crate ) run_ignored : bool ,
77 pub ( crate ) notifier : notify:: ArcNotifier ,
8+ pub ( crate ) test_name : String ,
89}
910
1011impl TestContext {
@@ -36,6 +37,10 @@ impl TestContext {
3637 notify:: Elapsed ( self . start . elapsed ( ) )
3738 }
3839
40+ pub fn test_name ( & self ) -> & str {
41+ & self . test_name
42+ }
43+
3944 pub ( crate ) fn notifier ( & self ) -> & notify:: ArcNotifier {
4045 & self . notifier
4146 }
@@ -46,6 +51,7 @@ impl TestContext {
4651 mode : self . mode ,
4752 run_ignored : self . run_ignored ,
4853 notifier : self . notifier . clone ( ) ,
54+ test_name : self . test_name . clone ( ) ,
4955 }
5056 }
5157}
Original file line number Diff line number Diff line change @@ -335,6 +335,7 @@ fn run(
335335 mode,
336336 run_ignored,
337337 notifier,
338+ test_name : String :: new ( ) ,
338339 } ;
339340
340341 let mut success = true ;
@@ -369,7 +370,8 @@ fn run(
369370 let cfg = std:: thread:: Builder :: new ( ) . name ( name. clone ( ) ) ;
370371 let thread_tx = tx. clone ( ) ;
371372 let thread_case = case. clone ( ) ;
372- let thread_context = context. clone ( ) ;
373+ let mut thread_context = context. clone ( ) ;
374+ thread_context. test_name = name. clone ( ) ;
373375 let thread_sync_success = sync_success. clone ( ) ;
374376 let join_handle = cfg. spawn ( move || {
375377 let status = run_case ( thread_case. as_ref ( ) . as_ref ( ) , & thread_context) ;
You can’t perform that action at this time.
0 commit comments