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=
|
setlocal errorformat=
|
||||||
\Found\ errors\ in\ %f:%.%#:
|
\Found\ errors\ in\ %f:%.%#:
|
||||||
|
|
||||||
let &l:makeprg=fnamemodify( findfile( 'run_tests', '.;' ), ':p' )
|
let s:run_tests = findfile( 'run_tests', '.;' )
|
||||||
\ . ' $* 2>&1'
|
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' )
|
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 . "'"
|
echo "Running test '" . l:test_func_name . "'"
|
||||||
|
|
||||||
let l:test_arg = expand( '%:p:t' ) . ':' . 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
|
endfunction
|
||||||
|
|
||||||
function! s:RunTest()
|
function! s:RunTest()
|
||||||
update
|
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
|
endfunction
|
||||||
|
|
||||||
function! s:RunAllTests()
|
function! s:RunAllTests()
|
||||||
update
|
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
|
endfunction
|
||||||
|
|
||||||
if ! has( 'gui_running' )
|
if ! has( 'gui_running' )
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
source lib/shared.vim
|
|
||||||
|
|
||||||
function! SetUp()
|
function! SetUp()
|
||||||
if exists ( 'g:loaded_vimpector' )
|
if exists ( 'g:loaded_vimpector' )
|
||||||
unlet g:loaded_vimpector
|
unlet g:loaded_vimpector
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,6 @@ if !has('terminal')
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
source lib/shared.vim
|
|
||||||
|
|
||||||
" Run Vim with "arguments" in a new terminal window.
|
" Run Vim with "arguments" in a new terminal window.
|
||||||
" By default uses a size of 20 lines and 75 columns.
|
" By default uses a size of 20 lines and 75 columns.
|
||||||
" Returns the buffer number of the terminal.
|
" 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:
|
" When debugging a test it can be useful to add messages to v:errors:
|
||||||
" call add(v:errors, "this happened")
|
" 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')
|
if has('packages')
|
||||||
let &packpath = &rtp
|
let &packpath = &rtp
|
||||||
endif
|
endif
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
source lib/shared.vim
|
|
||||||
|
|
||||||
function! SetUp()
|
function! SetUp()
|
||||||
if exists ( 'g:loaded_vimpector' )
|
if exists ( 'g:loaded_vimpector' )
|
||||||
unlet g:loaded_vimpector
|
unlet g:loaded_vimpector
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue