go-table-driven-tests
Installation
SKILL.md
Go Table-Driven Tests
Use when writing or modifying Go table-driven tests in this codebase. This skill ensures tests follow the established patterns.
Core Principles
- One test function, many cases - Define a slice of test cases and iterate with
t.Run() - Explicit naming - Each case has a
namefield that becomes the subtest name - Structured inputs - Use struct fields for inputs, expected outputs, and configuration
- Helper functions - Use
t.Helper()in test helpers for proper line reporting - Environment guards - Skip integration tests when credentials aren't available