File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -485,6 +485,14 @@ function! rust#Test(all, options) abort
485
485
return
486
486
endif
487
487
488
+ let mod_name = expand (' %:t:r' )
489
+ if mod_name == # ' '
490
+ echohl ErrorMsg
491
+ echo ' Cannot extract a module name from file name. Please add ! to command if you want to run all tests'
492
+ echohl None
493
+ return
494
+ endif
495
+
488
496
let saved = getpos (' .' )
489
497
try
490
498
let func_name = s: SearchTestFunctionNameUnderCursor ()
@@ -494,10 +502,11 @@ function! rust#Test(all, options) abort
494
502
echohl None
495
503
return
496
504
endif
505
+ let spec = mod_name . ' ::' . func_name
497
506
if a: options == # ' '
498
- execute cmd . ' cargo test --manifest-path' manifest func_name
507
+ execute cmd . ' cargo test --manifest-path' manifest spec
499
508
else
500
- execute cmd . ' cargo test --manifest-path' manifest func_name a: options
509
+ execute cmd . ' cargo test --manifest-path' manifest spec a: options
501
510
endif
502
511
return
503
512
finally
You can’t perform that action at this time.
0 commit comments