Last active
August 29, 2015 13:55
-
-
Save jonmorehouse/8762219 to your computer and use it in GitHub Desktop.
Go test runner for vim editor
This file contains hidden or 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
fu! GoTestPackage() | |
let command = "go test ." | |
call CleanShell(command) | |
endfunction | |
fu! GoTestFile() | |
if @% !~ ".go" | |
return | |
elseif @% =~ "_test.go" | |
let file = @% | |
else | |
let file = split(@%, ".go")[0] . "_test.go" | |
endif | |
" now run go tests | |
let command = "go test -v " . file | |
" now run this command | |
call CleanShell(command) | |
endfunction | |
map <Leader>rr :call GoTestFile()<CR> | |
map <Leader>r :call GoTestPackage()<CR> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment