File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ use std::ffi::OsString;
22
33use crate :: core:: compiler:: { Compilation , CompileKind , Doctest , UnitOutput } ;
44use crate :: core:: shell:: Verbosity ;
5- use crate :: core:: Workspace ;
5+ use crate :: core:: { TargetKind , Workspace } ;
66use crate :: ops;
77use crate :: util:: errors:: CargoResult ;
88use crate :: util:: { CargoTestError , Config , ProcessError , Test } ;
@@ -85,7 +85,24 @@ fn run_unit_tests(
8585 } in compilation. tests . iter ( )
8686 {
8787 let test = unit. target . name ( ) . to_string ( ) ;
88- let exe_display = path. strip_prefix ( cwd) . unwrap_or ( path) . display ( ) ;
88+
89+ let test_path = unit. target . src_path ( ) . path ( ) . unwrap ( ) ;
90+ let exe_display = if let TargetKind :: Test = unit. target . kind ( ) {
91+ format ! (
92+ "{} ({})" ,
93+ test_path
94+ . strip_prefix( unit. pkg. root( ) )
95+ . unwrap_or( & test_path)
96+ . display( ) ,
97+ path. strip_prefix( cwd) . unwrap_or( path) . display( )
98+ )
99+ } else {
100+ format ! (
101+ "unittests ({})" ,
102+ path. strip_prefix( cwd) . unwrap_or( path) . display( )
103+ )
104+ } ;
105+
89106 let mut cmd = compilation. target_process ( path, unit. kind , & unit. pkg , * script_meta) ?;
90107 cmd. args ( test_args) ;
91108 if unit. target . harness ( ) && config. shell ( ) . verbosity ( ) == Verbosity :: Quiet {
You can’t perform that action at this time.
0 commit comments