Refactor test framework into a vim plugin.
This commit is contained in:
parent
08133827ab
commit
55c75fd08e
6 changed files with 25 additions and 12 deletions
|
|
@ -23,8 +23,9 @@ let current_compiler = "vimspector_test"
|
|||
setlocal errorformat=
|
||||
\Found\ errors\ in\ %f:%.%#:
|
||||
|
||||
let &l:makeprg=fnamemodify( findfile( 'run_tests', '.;' ), ':p' )
|
||||
\ . ' $* 2>&1'
|
||||
let s:run_tests = findfile( 'run_tests', '.;' )
|
||||
let s:root_dir = fnamemodify( s:run_tests, ':h' )
|
||||
let &l:makeprg=fnamemodify( s:run_tests, ':p' ) . ' $* 2>&1'
|
||||
|
||||
let s:make_cmd = get( g:, 'vimspector_test_make_cmd', 'Make' )
|
||||
|
||||
|
|
@ -86,17 +87,35 @@ function! s:RunTestUnderCursor()
|
|||
echo "Running test '" . l:test_func_name . "'"
|
||||
|
||||
let l:test_arg = expand( '%:p:t' ) . ':' . l:test_func_name
|
||||
execute s:make_cmd . ' ' . l:test_arg
|
||||
let l:cwd = getcwd()
|
||||
execute 'lcd ' . s:root_dir
|
||||
try
|
||||
execute s:make_cmd . ' ' . l:test_arg
|
||||
finally
|
||||
execute 'lcd ' . l:cwd
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! s:RunTest()
|
||||
update
|
||||
execute s:make_cmd . ' %:p:t'
|
||||
let l:cwd = getcwd()
|
||||
execute 'lcd ' . s:root_dir
|
||||
try
|
||||
execute s:make_cmd . ' %:p:t'
|
||||
finally
|
||||
execute 'lcd ' . l:cwd
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! s:RunAllTests()
|
||||
update
|
||||
execute s:make_cmd
|
||||
let l:cwd = getcwd()
|
||||
execute 'lcd ' . s:root_dir
|
||||
try
|
||||
execute s:make_cmd
|
||||
finally
|
||||
execute 'lcd ' . l:cwd
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
if ! has( 'gui_running' )
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
source lib/shared.vim
|
||||
|
||||
function! SetUp()
|
||||
if exists ( 'g:loaded_vimpector' )
|
||||
unlet g:loaded_vimpector
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@ if !has('terminal')
|
|||
finish
|
||||
endif
|
||||
|
||||
source lib/shared.vim
|
||||
|
||||
" Run Vim with "arguments" in a new terminal window.
|
||||
" By default uses a size of 20 lines and 75 columns.
|
||||
" Returns the buffer number of the terminal.
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
" When debugging a test it can be useful to add messages to v:errors:
|
||||
" call add(v:errors, "this happened")
|
||||
|
||||
set rtp=$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after
|
||||
set rtp=$PWD/lib,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after
|
||||
if has('packages')
|
||||
let &packpath = &rtp
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
source lib/shared.vim
|
||||
|
||||
function! SetUp()
|
||||
if exists ( 'g:loaded_vimpector' )
|
||||
unlet g:loaded_vimpector
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue