Add support for named tests (#50)
* fix(typo): README.md (#47) * feat: add support for named tests * test * tags in table * debug installer msg * test * hardcoded @develop * get gotests tag from setup() * update readme * store install tag in urls table * removed gotests tag * update README.md * remove urls installer index reference * remove named arg from add_test() * . * update README.md * update README.md --------- Co-authored-by: Steve M <gearcog@users.noreply.github.com>
This commit is contained in:
parent
8a6f7748ef
commit
cdb1cd05a3
3 changed files with 47 additions and 1 deletions
40
README.md
40
README.md
|
|
@ -39,9 +39,47 @@ require("gopher").setup {
|
|||
impl = "impl",
|
||||
iferr = "iferr",
|
||||
},
|
||||
gotests = {
|
||||
-- gotests doesn't have template named "default" so this plugin uses "default" to set the default template
|
||||
template = "default",
|
||||
-- path to a directory containing custom test code templates
|
||||
template_dir = nil,
|
||||
-- switch table tests from using slice to map (with test name for the key)
|
||||
-- works only with gotests installed from develop branch
|
||||
named = false,
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
### Named tests with testify (using map instead of slice for test cases)
|
||||
|
||||
```lua
|
||||
require("gopher").setup({
|
||||
gotests = {
|
||||
template = "testify",
|
||||
named = true
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
For named tests to work you have to install gotests from develop branch, for example using [mason-tool-installer](https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim):
|
||||
|
||||
```lua
|
||||
require('mason-tool-installer').setup({
|
||||
ensure_installed = {
|
||||
{ "gotests", version = "develop" },
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
Or by calling `vim.fn.jobstart`:
|
||||
|
||||
```lua
|
||||
vim.fn.jobstart("go install github.com/cweill/gotests/...@develop")
|
||||
```
|
||||
|
||||
If you're using `lazy.nvim` you can put in `build` function inside `setup()`
|
||||
|
||||
## Features
|
||||
|
||||
1. Installation requires this go tool:
|
||||
|
|
@ -104,7 +142,7 @@ Example of usage:
|
|||
|
||||
6. Generate tests with [gotests](https://github.com/cweill/gotests)
|
||||
|
||||
Generate one test for spesific function/method:
|
||||
Generate one test for a specific function/method:
|
||||
|
||||
```vim
|
||||
:GoTestAdd
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue