[Go实战]怎么写测试类,运用testing.T

70 阅读1分钟

1. 命名时一定要有test字眼,例如dong_test.go

2.如下 包名可以是其他,不一定要main

package main

import (
	"testing"
)

func TestHelloWorld(t *testing.T) {
	t.Log("HelloWorld")
}