I have a single test function in my _test.go file with a bunch of sub tests. It looks like this:
func MyTest(t *testing.T) {
t.Run("Subtest1", func(t *testing.T) {
...
})
t.Run("Subtest2", func(t *testing.T) {
...
})
}
I run the test with go test
and get
PASS
ok package_path 9.137s
However, I would like to see listed all my subtests in the result. Looking at the Run
function in $GOROOT/src/testing/testing.go
it looks like I need the test to be chatty
.
So I tried to run the test via go test -v
but I still do not get the desired output. Instead my test is now failing:
=== RUN MyTest
api.test: error: expected argument for flag '-t', try --help
exit status 1
FAIL package_path 0.004s
--help
does not show anything about -t
Aucun commentaire:
Enregistrer un commentaire