nvim: integrate testr for tests
This commit is contained in:
parent
7f90afaabc
commit
07c958323f
@ -2,3 +2,4 @@ animdl
|
|||||||
td-watson
|
td-watson
|
||||||
cppman
|
cppman
|
||||||
git+https://github.com/idanpa/calcpy
|
git+https://github.com/idanpa/calcpy
|
||||||
|
git+https://github.com/dogeystamp/testr
|
||||||
|
@ -91,3 +91,6 @@ function prob_cpp; echo $EDITOR src/(basename (xsel -b)).cpp; end
|
|||||||
abbr -a cpp --function prob_cpp
|
abbr -a cpp --function prob_cpp
|
||||||
function prob_py; echo $EDITOR src/(basename (xsel -b)).py; end
|
function prob_py; echo $EDITOR src/(basename (xsel -b)).py; end
|
||||||
abbr -a py --function prob_py
|
abbr -a py --function prob_py
|
||||||
|
# see src/.config/nvim/vimspector.vim and search for TestRunner()
|
||||||
|
function prob_testdir; echo \~/.cache/termdebug/tests/src/(basename (xsel -b)); end
|
||||||
|
abbr -a --position anywhere tesd --function prob_testdir
|
||||||
|
@ -49,6 +49,23 @@ function RunInput()
|
|||||||
endfunction
|
endfunction
|
||||||
nnoremap <silent> <leader>ri :call RunInput()<cr>
|
nnoremap <silent> <leader>ri :call RunInput()<cr>
|
||||||
|
|
||||||
|
" use test runner
|
||||||
|
function TestRunner()
|
||||||
|
if expand("%:e") == "cpp"
|
||||||
|
let binary=$HOME .. "/.cache/termdebug/bin/" .. expand("%:r")
|
||||||
|
else
|
||||||
|
let binary=expand("%:p")
|
||||||
|
endif
|
||||||
|
let testfolder=$HOME .. "/.cache/termdebug/tests/" .. expand("%:r")
|
||||||
|
silent exec "!mkdir -p " .. testfolder
|
||||||
|
vsp
|
||||||
|
vertical resize 40
|
||||||
|
normal G
|
||||||
|
exec 'terminal ' .. 'testr --exec ' .. binary .. " --testdir " .. testfolder
|
||||||
|
exec "norm \<c-w>h"
|
||||||
|
endfunction
|
||||||
|
nnoremap <silent> <leader>dt :call TestRunner()<cr>
|
||||||
|
|
||||||
" debugging program flow
|
" debugging program flow
|
||||||
nnoremap <silent> <leader>rs :call vimspector#Restart()<cr>
|
nnoremap <silent> <leader>rs :call vimspector#Restart()<cr>
|
||||||
nnoremap <silent> <leader>rr :call vimspector#Stop()<cr>
|
nnoremap <silent> <leader>rr :call vimspector#Stop()<cr>
|
||||||
|
Loading…
Reference in New Issue
Block a user