Created
January 20, 2016 09:14
-
-
Save zamaterian/7954374bda4b60ae696f to your computer and use it in GitHub Desktop.
Run a single clojure test within a fixture from vim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" depends on vim-fireplace | |
function! ClojureTestFixture() abort | |
"Eval the toplevel clojure form (a deftest) and then test-var the result. | |
"http://blog.venanti.us/clojure-vim/ | |
normal! ^ | |
let line1 = searchpair('(','',')', 'bcrn', g:fireplace#skip) | |
let line2 = searchpair('(','',')', 'rn', g:fireplace#skip) | |
let expr = join(getline(line1, line2), "\n") | |
let var = fireplace#session_eval(expr) | |
" only handles one fixture, look into clojure.test for examples combining the fixtures | |
let sexp = "(clojure.test/test-var ((or (first (:clojure.test/once-fixtures (meta *ns* ))) identity) " . var . "))" | |
" echo sexp | |
" | |
let result = fireplace#echo_session_eval(sexp) | |
return result | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment