feat(gotests): add generate all tests
docs(gotests): add generate all tests
This commit is contained in:
parent
acd414d454
commit
70297f28e7
4 changed files with 18 additions and 0 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
Minimalistic plugin for Go development in Neovim written in Lua.
|
Minimalistic plugin for Go development in Neovim written in Lua.
|
||||||
|
|
||||||
It's not an LSP tool, the main goal of this plugin add go tooling support in neovim.
|
It's not an LSP tool, the main goal of this plugin add go tooling support in neovim.
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
Pre-dependency: [go](https://github.com/golang/go) (tested on 1.17 and 1.18)
|
Pre-dependency: [go](https://github.com/golang/go) (tested on 1.17 and 1.18)
|
||||||
|
|
@ -86,6 +87,12 @@ Generate one test for spesific function/method
|
||||||
:GoTestAdd
|
:GoTestAdd
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Generate all tests for all functions/methods in current file
|
||||||
|
|
||||||
|
```vim
|
||||||
|
:GoTestsAll
|
||||||
|
```
|
||||||
|
|
||||||
7. Run `go generate` command
|
7. Run `go generate` command
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
|
|
|
||||||
|
|
@ -45,4 +45,13 @@ function M.func_test(parallel)
|
||||||
add_test(cmd_args)
|
add_test(cmd_args)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.all_tests(parallel)
|
||||||
|
local cmd_args = { "-all" }
|
||||||
|
if parallel then
|
||||||
|
table.insert(cmd_args, "-parallel")
|
||||||
|
end
|
||||||
|
|
||||||
|
add_test(cmd_args)
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
||||||
|
|
@ -10,5 +10,6 @@ gopher.get = require "gopher.goget"
|
||||||
gopher.impl = require "gopher.impl"
|
gopher.impl = require "gopher.impl"
|
||||||
gopher.generate = require "gopher.gogenerate"
|
gopher.generate = require "gopher.gogenerate"
|
||||||
gopher.test_add = gotests.one_test
|
gopher.test_add = gotests.one_test
|
||||||
|
gopher.tests_all = gotests.all_tests
|
||||||
|
|
||||||
return gopher
|
return gopher
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
command! -nargs=* GoTagAdd :lua require"gopher".tags_add(<f-args>)
|
command! -nargs=* GoTagAdd :lua require"gopher".tags_add(<f-args>)
|
||||||
command! -nargs=* GoTagRm :lua require"gopher".tags_rm(<f-args>)
|
command! -nargs=* GoTagRm :lua require"gopher".tags_rm(<f-args>)
|
||||||
command! -nargs=* GoTestAdd :lua require"gopher".test_add(<f-args>)
|
command! -nargs=* GoTestAdd :lua require"gopher".test_add(<f-args>)
|
||||||
|
command! -nargs=* GoTestsAll :lua require"gopher".tests_all(<f-args>)
|
||||||
command! -nargs=* GoMod :lua require"gopher".mod(<f-args>)
|
command! -nargs=* GoMod :lua require"gopher".mod(<f-args>)
|
||||||
command! -nargs=* GoGet :lua require"gopher".get(<f-args>)
|
command! -nargs=* GoGet :lua require"gopher".get(<f-args>)
|
||||||
command! -nargs=* GoImpl :lua require"gopher".impl(<f-args>)
|
command! -nargs=* GoImpl :lua require"gopher".impl(<f-args>)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue