← Back to list

go-testing-helpers
by JamesPrial
WIP - collection of various Claude stuff i make/use/have_Claude_hallucinate
⭐ 2🍴 0📅 Jan 23, 2026
SKILL.md
name: go-testing-helpers description: Test helper patterns with t.Helper()
Test Helpers
Extract common test logic into helper functions with t.Helper().
CORRECT
func assertEqual(t *testing.T, got, want interface{}) {
t.Helper() // Reports caller line, not helper line
if got != want {
t.Errorf("got %v, want %v", got, want)
}
}
func assertNoError(t *testing.T, err error) {
t.Helper()
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
}
func Test_Process(t *testing.T) {
result, err := Process("input")
assertNoError(t, err)
assertEqual(t, result, "expected")
}
Why:
- t.Helper() marks function as helper
- Error reports show caller line, not helper line
- Reduces test boilerplate
- Consistent assertion patterns
WRONG
func assertEqual(t *testing.T, got, want interface{}) {
// Missing t.Helper()
if got != want {
t.Errorf("got %v, want %v", got, want)
}
}
Problems:
- Errors point to helper line
- Hard to find actual test failure
- Confusing stack traces
Score
Total Score
65/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
✓最近の活動
1ヶ月以内に更新
+10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
✓タグ
1つ以上のタグが設定されている
+5
Reviews
💬
Reviews coming soon
