go-table-driven-tests
✓按照 Go 社区最佳实践和此存储库的约定编写 Go 表驱动测试。在编写或重构 Go 测试时使用,特别是当您注意到重复的测试模式或复制粘贴的测试代码时。
SKILL.md
Table-driven tests are a Go testing idiom that reduces code duplication and makes tests more maintainable. Instead of writing separate test functions for each case, you define a table of test cases and iterate over it.
Do NOT use for: Completely unrelated test scenarios, or when each test requires substantially different setup/teardown logic.
Use a map when you want to ensure test independence:
按照 Go 社区最佳实践和此存储库的约定编写 Go 表驱动测试。在编写或重构 Go 测试时使用,特别是当您注意到重复的测试模式或复制粘贴的测试代码时。 来源:xe/x。
可引用信息
为搜索与 AI 引用准备的稳定字段与命令。
- 安装命令
npx skills add https://github.com/xe/x --skill go-table-driven-tests- 来源
- xe/x
- 分类
- </>开发工具
- 认证
- ✓
- 收录时间
- 2026-02-05
- 更新时间
- 2026-02-18
快速解答
什么是 go-table-driven-tests?
按照 Go 社区最佳实践和此存储库的约定编写 Go 表驱动测试。在编写或重构 Go 测试时使用,特别是当您注意到重复的测试模式或复制粘贴的测试代码时。 来源:xe/x。
如何安装 go-table-driven-tests?
打开你的终端或命令行工具(如 Terminal、iTerm、Windows Terminal 等) 复制并运行以下命令:npx skills add https://github.com/xe/x --skill go-table-driven-tests 安装完成后,技能将自动配置到你的 AI 编程环境中,可以在 Claude Code 或 Cursor 中使用
这个 Skill 的源码在哪?
https://github.com/xe/x