npx claudepluginhub jamesprial/prial-plugins --plugin golang-workflowThis skill uses the workspace's default tool permissions.
Use when you have 2+ test cases for the same function.
Guides table-driven tests in Go: when to use/avoid, struct design, subtest naming, test matrices, shared setup, and refactoring bloated tables. Use for writing, reviewing, or refactoring them.
Writes, reviews, and improves Go tests using table-driven tests, subtests, parallel tests, helpers, test doubles, cmp.Diff assertions, and Google/Uber style guides.
Reviews Go test code for table-driven tests, assertions, parallel execution, cleanup, mocking, benchmarks, fuzzing, httptest, and coverage patterns in *_test.go files.
Share bugs, ideas, or general feedback.
Use when you have 2+ test cases for the same function.
func Test_Add_Cases(t *testing.T) {
tests := []struct {
name string
a int
b int
want int
}{
{name: "positive numbers", a: 2, b: 3, want: 5},
{name: "negative numbers", a: -1, b: -2, want: -3},
{name: "zero", a: 0, b: 0, want: 0},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := Add(tt.a, tt.b)
if got != tt.want {
t.Errorf("Add(%d, %d) = %d, want %d", tt.a, tt.b, got, tt.want)
}
})
}
}
Why:
func Test_Add(t *testing.T) {
if Add(2, 3) != 5 {
t.Error("2 + 3 failed")
}
if Add(-1, -2) != -3 {
t.Error("-1 + -2 failed")
}
if Add(0, 0) != 0 {
t.Error("0 + 0 failed")
}
}
Problems: