core: Remove fallback for subtests before Go 1.7
This commit is contained in:
parent
02c5942843
commit
b0be7f4cb3
|
@ -1,22 +0,0 @@
|
|||
// +build go1.7
|
||||
|
||||
package tusd_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
)
|
||||
|
||||
func SubTest(t *testing.T, name string, runTest func(*testing.T, *MockFullDataStore)) {
|
||||
t.Run(name, func(subT *testing.T) {
|
||||
//subT.Parallel()
|
||||
|
||||
ctrl := gomock.NewController(subT)
|
||||
defer ctrl.Finish()
|
||||
|
||||
store := NewMockFullDataStore(ctrl)
|
||||
|
||||
runTest(subT, store)
|
||||
})
|
||||
}
|
|
@ -1,35 +1,20 @@
|
|||
// +build !go1.7
|
||||
|
||||
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)) {
|
||||
subTestDepth++
|
||||
defer func() { subTestDepth-- }()
|
||||
p := strings.Repeat("\t", subTestDepth)
|
||||
t.Run(name, func(subT *testing.T) {
|
||||
//subT.Parallel()
|
||||
|
||||
fmt.Println(p, "=== RUN SubTest:", name)
|
||||
|
||||
ctrl := gomock.NewController(t)
|
||||
ctrl := gomock.NewController(subT)
|
||||
defer ctrl.Finish()
|
||||
|
||||
store := NewMockFullDataStore(ctrl)
|
||||
|
||||
runTest(t, store)
|
||||
|
||||
if t.Failed() {
|
||||
fmt.Println(p, "--- FAIL SubTest:", name)
|
||||
t.FailNow()
|
||||
} else {
|
||||
fmt.Println(p, "--- PASS SubTest:", name)
|
||||
}
|
||||
runTest(subT, store)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue