63 lines
1.5 KiB
Markdown
63 lines
1.5 KiB
Markdown
# test-samurai-go-runner.nvim
|
|
|
|
Go runner for `test-samurai.nvim`.
|
|
|
|
Main plugin: https://gitea.mschirmer.com/m13r/test-samurai.nvim
|
|
|
|
## Features
|
|
|
|
- Detects Go test files (`*_test.go`).
|
|
- Finds nearest `Test*`, `Example*`, and `Benchmark*` functions.
|
|
- Builds `go test` commands for nearest, file, all, and failed-only runs.
|
|
- Parses `go test` output to list passes, failures, and skips.
|
|
|
|
## Installation (lazy.nvim)
|
|
|
|
```lua
|
|
{
|
|
"m13r/test-samurai.nvim",
|
|
dependencies = {
|
|
"m13r/test-samurai-go-runner.nvim",
|
|
},
|
|
config = function()
|
|
require("test-samurai").setup({
|
|
runners = {
|
|
require("test-samurai-go-runner"),
|
|
},
|
|
})
|
|
end,
|
|
}
|
|
```
|
|
|
|
## Local Development (lazy.nvim)
|
|
|
|
```lua
|
|
{
|
|
"m13r/test-samurai.nvim",
|
|
dependencies = {
|
|
{
|
|
"test-samurai-go-runner.nvim",
|
|
dir = "/absolute/path/to/test-samurai-go-runner.nvim",
|
|
},
|
|
},
|
|
config = function()
|
|
require("test-samurai").setup({
|
|
runners = {
|
|
require("test-samurai-go-runner"),
|
|
},
|
|
})
|
|
end,
|
|
}
|
|
```
|
|
|
|
## Usage
|
|
|
|
Use the standard `test-samurai.nvim` commands (e.g. `TSamNearest`, `TSamFile`, `TSamAll`, `TSamFailedOnly`).
|
|
|
|
## Notes
|
|
|
|
- Subtests (`t.Run`) are reported as separate entries via `go test -json -v`.
|
|
- Subtest selection uses anchored patterns (`^Parent$/^Sub$`) to avoid matching the same subtest name in other tests.
|
|
- `go test` cannot scope execution to a single file; if two tests in the same package share the same test and subtest names, both will run.
|
|
- Result lists are ordered so that parent tests appear before their subtests within each status.
|