Improve output of subtests when emulated

This commit is contained in:
Marius 2016-10-13 12:59:11 +02:00
parent 9b4126cae6
commit df378704ce
2 changed files with 11 additions and 4 deletions

View File

@ -24,4 +24,4 @@ fi
go get -u github.com/aws/aws-sdk-go/...
# Test all packages which are allowed on all Go versions
go test $packages
go test -v $packages

View File

@ -4,13 +4,20 @@ package tusd_test
import (
"fmt"
"strings"
"testing"
"github.com/golang/mock/gomock"
)
var subTestDepth = 0
func SubTest(t *testing.T, name string, runTest func(*testing.T, *MockFullDataStore)) {
fmt.Println("\t=== RUN SubTest:", name)
subTestDepth++
defer func() { subTestDepth-- }()
p := strings.Repeat("\t", subTestDepth)
fmt.Println(p, "=== RUN SubTest:", name)
ctrl := gomock.NewController(t)
defer ctrl.Finish()
@ -20,9 +27,9 @@ func SubTest(t *testing.T, name string, runTest func(*testing.T, *MockFullDataSt
runTest(t, store)
if t.Failed() {
fmt.Println("\t--- FAIL SubTest:", name)
fmt.Println(p, "--- FAIL SubTest:", name)
t.FailNow()
} else {
fmt.Println("\t--- PASS SubTest:", name)
fmt.Println(p, "--- PASS SubTest:", name)
}
}