[mirror] Make your go dev experience better github.com/olexsmir/gopher.nvim
neovim golang

feat(gotests): generate tests only for exported func

docs(gotests): generate test for exported funcs

Changed files
+20
lua
plugin
+6
README.md
··· 93 93 :GoTestsAll 94 94 ``` 95 95 96 + Generate tests only for exported functions/methods in current file 97 + 98 + ```vim 99 + :GoTestsExp 100 + ``` 101 + 96 102 7. Run `go generate` command 97 103 98 104 ```vim
+12
lua/gopher/gotests.lua
··· 56 56 add_test(cmd_args) 57 57 end 58 58 59 + ---generate unit tests for all exported functions 60 + ---@param parallel boolean 61 + function M.all_exported_tests(parallel) 62 + local cmd_args = {} 63 + if parallel then 64 + table.insert(cmd_args, "-parallel") 65 + end 66 + 67 + table.insert(cmd_args, "-exported") 68 + add_test(cmd_args) 69 + end 70 + 59 71 return M
+1
lua/gopher/init.lua
··· 10 10 gopher.impl = require "gopher.impl" 11 11 gopher.generate = require "gopher.gogenerate" 12 12 gopher.test_add = gotests.one_test 13 + gopher.test_exported = gotests.all_exported_tests 13 14 gopher.tests_all = gotests.all_tests 14 15 15 16 return gopher
+1
plugin/gopher.vim
··· 2 2 command! -nargs=* GoTagRm :lua require"gopher".tags_rm(<f-args>) 3 3 command! -nargs=* GoTestAdd :lua require"gopher".test_add(<f-args>) 4 4 command! -nargs=* GoTestsAll :lua require"gopher".tests_all(<f-args>) 5 + command! -nargs=* GoTestsExp :lua require"gopher".test_exported(<f-args>) 5 6 command! -nargs=* GoMod :lua require"gopher".mod(<f-args>) 6 7 command! -nargs=* GoGet :lua require"gopher".get(<f-args>) 7 8 command! -nargs=* GoImpl :lua require"gopher".impl(<f-args>)