go-testing-table
Installation
SKILL.md
Table-Driven Tests
Use when you have 2+ test cases for the same function.
CORRECT
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},
}