diff --git a/doc/fireplace.txt b/doc/fireplace.txt index bb775ec..67fd95f 100644 --- a/doc/fireplace.txt +++ b/doc/fireplace.txt @@ -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. :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* cp{motion} Eval/print the code indicated by {motion}. diff --git a/plugin/fireplace.vim b/plugin/fireplace.vim index c7af283..6364460 100644 --- a/plugin/fireplace.vim +++ b/plugin/fireplace.vim @@ -1584,33 +1584,32 @@ function! fireplace#capture_test_run(expr, ...) abort endfor endfunction -function! s:RunTests(bang, ...) abort +function! s:RunTests(bang, count, ...) abort if &autowrite || &autowriteall silent! wall endif - 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, ' ').')' + if a:count < 0 + let pre = '' + if a:0 + let expr = '(clojure.test/run-all-tests #"'.join(a:000, '|').'")' + else + let expr = '(clojure.test/run-all-tests)' + endif + 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 endfunction -function! s:RunAllTests(bang, ...) abort - if a:0 - let expr = '(clojure.test/run-all-tests #"'.join(a:000, '|').'")' - else - let expr = '(clojure.test/run-all-tests)' - endif - call fireplace#capture_test_run(expr) - echo expr -endfunction - function! s:set_up_tests() abort - command! -buffer -bar -bang -nargs=* + command! -buffer -bar -bang -range=0 -nargs=* \ -complete=customlist,fireplace#ns_complete RunTests - \ call s:RunTests(0, ) + \ call s:RunTests(0, == 0 ? -1 : , ) command! -buffer -bang -nargs=* RunAllTests - \ call s:RunAllTests(0, ) + \ call s:RunTests(0, -1, ) endfunction augroup fireplace_tests