From b0be7f4cb3a05a263ff6f19b54859ea50bb5153b Mon Sep 17 00:00:00 2001 From: Marius Date: Tue, 11 Jun 2019 16:29:31 +0200 Subject: [PATCH] core: Remove fallback for subtests before Go 1.7 --- subtest_go17_test.go | 22 ---------------------- subtest_test.go | 29 +++++++---------------------- 2 files changed, 7 insertions(+), 44 deletions(-) delete mode 100644 subtest_go17_test.go diff --git a/subtest_go17_test.go b/subtest_go17_test.go deleted file mode 100644 index 272e106..0000000 --- a/subtest_go17_test.go +++ /dev/null @@ -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) - }) -} diff --git a/subtest_test.go b/subtest_test.go index 41a7f5b..d89a20d 100644 --- a/subtest_test.go +++ b/subtest_test.go @@ -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(subT) + defer ctrl.Finish() - ctrl := gomock.NewController(t) - defer ctrl.Finish() + store := NewMockFullDataStore(ctrl) - 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) + }) }