File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ use std::ffi::OsString;
2
2
3
3
use crate :: core:: compiler:: { Compilation , CompileKind , Doctest , UnitOutput } ;
4
4
use crate :: core:: shell:: Verbosity ;
5
- use crate :: core:: Workspace ;
5
+ use crate :: core:: { TargetKind , Workspace } ;
6
6
use crate :: ops;
7
7
use crate :: util:: errors:: CargoResult ;
8
8
use crate :: util:: { CargoTestError , Config , ProcessError , Test } ;
@@ -85,7 +85,24 @@ fn run_unit_tests(
85
85
} in compilation. tests . iter ( )
86
86
{
87
87
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
+
89
106
let mut cmd = compilation. target_process ( path, unit. kind , & unit. pkg , * script_meta) ?;
90
107
cmd. args ( test_args) ;
91
108
if unit. target . harness ( ) && config. shell ( ) . verbosity ( ) == Verbosity :: Quiet {
You can’t perform that action at this time.
0 commit comments