Last active
August 29, 2015 13:56
-
-
Save jebberjeb/9114733 to your computer and use it in GitHub Desktop.
Use vim-fireplace to run unit tests, highlight failed test fns in red!
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
function! RunTests() | |
" reload the namespace | |
norm cpr | |
" setup | |
call clearmatches() | |
highlight Red ctermbg=darkred | |
redir => output | |
" use Clojure to do the real work, run tests, | |
" parse the results | |
Eval (map #(subs % 9 (dec (count %))) (re-seq #"FAIL in \(\S*\)" (let [s# (new java.io.StringWriter)] (binding [*test-out* s#] (run-all-tests) (str s#))))) | |
redir END | |
" output will have the valid ('a-fn' 'b-fn') | |
" strip off the parens, then split on space | |
let output = output[2:len(output) - 2] | |
let parts = split(output, ' ') | |
" highlight each match | |
for part in parts | |
exec "call matchadd('Red'," . part . ")" | |
endfor | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment