go test 只跑某个测试用例
如有以下用例在包 foo/test 中:
func TestFoo(t *testing.T){}
func TestFoo1(t *testing.T){}
func TestAbc(t *testing.T){}
1. go test -v foo/test
将测试所有的用例 (-v 表示输出详细信息,无论成功失败)
2. go test -v -run TestFoo foo/test
将测试 TestFoo 和 TestFoo1
3. go test -v -run ^TestFoo$ foo/test
将只测试 TestFoo
网友评论