Skip to content

Commit 15a5049

Browse files
rhysdda-x
authored andcommitted
RustTest: use :terminal for running tests
1 parent e84cfa9 commit 15a5049

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

autoload/rust.vim

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,10 +468,20 @@ function! rust#Test(all, options) abort
468468
if manifest ==# ''
469469
return rust#Run(1, '--test ' . a:options)
470470
endif
471-
let manifest = shellescape(manifest)
471+
472+
if exists(':terminal')
473+
let cmd = 'terminal '
474+
else
475+
let cmd = '!'
476+
let manifest = shellescape(manifest)
477+
endif
472478

473479
if a:all
474-
execute '!cargo test --manifest-path' manifest a:options
480+
if a:options ==# ''
481+
execute cmd . 'cargo test --manifest-path' manifest
482+
else
483+
execute cmd . 'cargo test --manifest-path' manifest a:options
484+
endif
475485
return
476486
endif
477487

@@ -484,7 +494,11 @@ function! rust#Test(all, options) abort
484494
echohl None
485495
return
486496
endif
487-
execute '!cargo test --manifest-path' manifest func_name a:options
497+
if a:options ==# ''
498+
execute cmd . 'cargo test --manifest-path' manifest func_name
499+
else
500+
execute cmd . 'cargo test --manifest-path' manifest func_name a:options
501+
endif
488502
return
489503
finally
490504
call setpos('.', saved)

0 commit comments

Comments
 (0)