在 Manus 中运行任何 Skill
一键导入
一键导入
一键在 Manus 中运行任何 Skill
开始使用go-testing-subtests
星标3
分支0
更新时间2025年12月18日 03:03
Subtest patterns with t.Run
安装
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
SKILL.md
readonly菜单
Subtest patterns with t.Run
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Handle hook scripts and paths for plugin packaging
Package claudefiles components into a valid Claude Code plugin
Package language-specific subsets of claudefiles
Plugin validation errors and fixes
Common channel patterns and idioms
Context cancellation patterns for graceful shutdown
| name | go-testing-subtests |
| description | Subtest patterns with t.Run |
Use t.Run to group related tests and enable selective execution.
func Test_User_Validation(t *testing.T) {
t.Run("valid email", func(t *testing.T) {
user := User{Email: "test@example.com"}
if err := user.Validate(); err != nil {
t.Errorf("expected valid, got error: %v", err)
}
})
t.Run("invalid email", func(t *testing.T) {
user := User{Email: "invalid"}
if err := user.Validate(); err == nil {
t.Error("expected error, got nil")
}
})
t.Run("empty email", func(t *testing.T) {
user := User{Email: ""}
if err := user.Validate(); err == nil {
t.Error("expected error, got nil")
}
})
}
Run specific subtest:
go test -run Test_User_Validation/invalid_email
Why:
func Test_User_ValidEmail(t *testing.T) { /* ... */ }
func Test_User_InvalidEmail(t *testing.T) { /* ... */ }
func Test_User_EmptyEmail(t *testing.T) { /* ... */ }
Problems: