claude-code/claude-zh/rules/golang/testing.md

32 lines
562 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
paths:
- "**/*.go"
- "**/go.mod"
- "**/go.sum"
---
# Go 測試 (Testing)
> 本檔案擴展了 [common/testing.md](../common/testing.md),包含 Go 特定內容。
## 框架 (Framework)
使用標準的 `go test` 並搭配 **表格驅動測試 (Table-driven tests)**
## 競態偵測 (Race Detection)
執行測試時務必加上 `-race` 旗標:
```bash
go test -race ./...
```
## 覆蓋率 (Coverage)
```bash
go test -cover ./...
```
## 參考資源
參見技能 (Skill)`golang-testing`,獲取詳細的 Go 測試模式與小助手。