Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync develop and main #68

Merged
merged 25 commits into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9d6bc76
healthcheck: refactoring, remove deprecation wanings (#35)
olexsmir Jul 17, 2023
94250bb
add editorconfig (#36)
olexsmir Jul 17, 2023
26b41bf
refactor of public plugin's api (#37)
olexsmir Jul 19, 2023
bc3ce34
update tooling (#38)
olexsmir Jul 19, 2023
3d49d58
feat: run tests independent from user's nvim config
olexsmir Jul 19, 2023
e49f3fa
remove editorconfig-checker
olexsmir Jul 19, 2023
eac5560
fix(config): now it not removes .setup() from itself after calling
olexsmir Jul 19, 2023
3b0888a
fix(config): now it works correctly
olexsmir Jul 20, 2023
1841aed
chore: update taskfile, and linter config
olexsmir Jul 20, 2023
b5327cd
feat(config): make it optional to call .setup()
olexsmir Jul 20, 2023
5f8466d
run tests independent of user nvim setup (#39)
olexsmir Jul 20, 2023
4af6cae
fix(dap): now dlv uses cmd to run from config
olexsmir Jul 22, 2023
011769b
chore(ci): run tests on many versions of nvim
olexsmir Jul 22, 2023
2e89cea
refactor: commands runner (#42)
olexsmir Aug 10, 2023
e0a3e70
add ability for setting custom tools options (#44)
olexsmir Aug 17, 2023
bbe8931
fix(health): check if bin is installed, and added message about trees…
olexsmir Jan 12, 2024
8a6f774
fix: fix iferr config (#56)
arnevm123 Feb 10, 2024
cdb1cd0
Add support for named tests (#50)
ysomad Feb 11, 2024
ebb10e9
reformat .editorconfig config
olexsmir Feb 11, 2024
28e1f56
refactor(api)!: mave tags and gotests api into their sub tables
olexsmir Feb 24, 2024
10cec9c
add help file, and docs (#59)
olexsmir Apr 4, 2024
65fa148
refactor(health): keep in mind new way of health check (#63)
olexsmir Apr 4, 2024
fbf6441
feat: add logger (#64)
olexsmir Jun 15, 2024
af1d5d1
add deprecation message (#67)
olexsmir Jun 15, 2024
a5becfc
Merge branch 'main' into develop
olexsmir Jun 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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 <[email protected]>
  • Loading branch information
ysomad and gearcog committed Feb 11, 2024
commit cdb1cd05a329c8d5b6a57e2d550852deca572b6a
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions lua/gopher/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ local default_config = {
-- path to a directory containing custom test code templates
---@type string|nil
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
---@type boolean
named = false,
},
---@class gopher.ConfigGoTag
gotag = {
Expand Down
4 changes: 4 additions & 0 deletions lua/gopher/gotests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ local gotests = {}

---@param args table
local function add_test(args)
if c.gotests.named then
table.insert(args, "-named")
end

if c.gotests.template_dir then
table.insert(args, "-template_dir")
table.insert(args, c.gotests.template_dir)
Expand Down
Loading