测试

  • 测试名称 package_testpackage 要好
  • go test -short 允许减少要运行的测试数
  1. func TestSomething(t *testing.T) {
  2. if testing.Short() {
  3. t.Skip("skipping test in short mode.")
  4. }
  5. }
  • 根据系统架构跳过测试
  1. if runtime.GOARM == "arm" {
  2. t.Skip("this doesn't work under ARM")
  3. }