Make :0RunTests equivalent to RunAllTests

This commit is contained in:
Tim Pope 2015-06-25 15:04:12 -04:00
parent 1f478e401a
commit 69bf9ef519
2 changed files with 17 additions and 18 deletions

View File

@ -124,7 +124,7 @@ stack trace is loaded into the |location-list|. Use |:lopen| to view it.
and load the results into the quickfix list. and load the results into the quickfix list.
:RunAllTests [pattern] Call clojure.test/run-all-tests with the given pattern :RunAllTests [pattern] Call clojure.test/run-all-tests with the given pattern
and load the results into the quickfix list. :0RunTests [pattern] and load the results into the quickfix list.
*fireplace-cp* *fireplace-cp*
cp{motion} Eval/print the code indicated by {motion}. cp{motion} Eval/print the code indicated by {motion}.

View File

@ -1584,33 +1584,32 @@ function! fireplace#capture_test_run(expr, ...) abort
endfor endfor
endfunction endfunction
function! s:RunTests(bang, ...) abort function! s:RunTests(bang, count, ...) abort
if &autowrite || &autowriteall if &autowrite || &autowriteall
silent! wall silent! wall
endif endif
let reqs = map(copy(a:000), '"''".v:val') if a:count < 0
let pre = '(clojure.core/require '.join(empty(a:000) ? ["'".fireplace#ns()] : reqs, ' ').' :reload) ' let pre = ''
let expr = join(['(clojure.test/run-tests'] + reqs, ' ').')'
call fireplace#capture_test_run(expr, pre)
echo expr
endfunction
function! s:RunAllTests(bang, ...) abort
if a:0 if a:0
let expr = '(clojure.test/run-all-tests #"'.join(a:000, '|').'")' let expr = '(clojure.test/run-all-tests #"'.join(a:000, '|').'")'
else else
let expr = '(clojure.test/run-all-tests)' let expr = '(clojure.test/run-all-tests)'
endif endif
call fireplace#capture_test_run(expr) else
let reqs = map(copy(a:000), '"''".v:val')
let pre = '(clojure.core/require '.join(empty(a:000) ? ["'".fireplace#ns()] : reqs, ' ').' :reload) '
let expr = join(['(clojure.test/run-tests'] + reqs, ' ').')'
endif
call fireplace#capture_test_run(expr, pre)
echo expr echo expr
endfunction endfunction
function! s:set_up_tests() abort function! s:set_up_tests() abort
command! -buffer -bar -bang -nargs=* command! -buffer -bar -bang -range=0 -nargs=*
\ -complete=customlist,fireplace#ns_complete RunTests \ -complete=customlist,fireplace#ns_complete RunTests
\ call s:RunTests(<bang>0, <f-args>) \ call s:RunTests(<bang>0, <line1> == 0 ? -1 : <count>, <f-args>)
command! -buffer -bang -nargs=* RunAllTests command! -buffer -bang -nargs=* RunAllTests
\ call s:RunAllTests(<bang>0, <f-args>) \ call s:RunTests(<bang>0, -1, <f-args>)
endfunction endfunction
augroup fireplace_tests augroup fireplace_tests