diff options
Diffstat (limited to 'extras/hs-test/suite_tap_test.go')
-rw-r--r-- | extras/hs-test/suite_tap_test.go | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/extras/hs-test/suite_tap_test.go b/extras/hs-test/suite_tap_test.go index cb0653304c3..bb7082de480 100644 --- a/extras/hs-test/suite_tap_test.go +++ b/extras/hs-test/suite_tap_test.go @@ -13,14 +13,14 @@ type TapSuite struct { HstSuite } -var tapTests = []func(s *TapSuite){} -var tapSoloTests = []func(s *TapSuite){} +var tapTests = map[string][]func(s *TapSuite){} +var tapSoloTests = map[string][]func(s *TapSuite){} func registerTapTests(tests ...func(s *TapSuite)) { - tapTests = append(tapTests, tests...) + tapTests[getTestFilename()] = tests } func registerTapSoloTests(tests ...func(s *TapSuite)) { - tapSoloTests = append(tapSoloTests, tests...) + tapSoloTests[getTestFilename()] = tests } func (s *TapSuite) SetupSuite() { @@ -44,15 +44,17 @@ var _ = Describe("TapSuite", Ordered, ContinueOnFailure, func() { s.TearDownTest() }) - for _, test := range tapTests { - test := test - pc := reflect.ValueOf(test).Pointer() - funcValue := runtime.FuncForPC(pc) - testName := strings.Split(funcValue.Name(), ".")[2] - It(testName, func(ctx SpecContext) { - s.log(testName + ": BEGIN") - test(&s) - }, SpecTimeout(suiteTimeout)) + for filename, tests := range tapTests { + for _, test := range tests { + test := test + pc := reflect.ValueOf(test).Pointer() + funcValue := runtime.FuncForPC(pc) + testName := filename + "/" + strings.Split(funcValue.Name(), ".")[2] + It(testName, func(ctx SpecContext) { + s.log(testName + ": BEGIN") + test(&s) + }, SpecTimeout(suiteTimeout)) + } } }) @@ -71,14 +73,16 @@ var _ = Describe("TapSuiteSolo", Ordered, ContinueOnFailure, Serial, func() { s.TearDownTest() }) - for _, test := range tapSoloTests { - test := test - pc := reflect.ValueOf(test).Pointer() - funcValue := runtime.FuncForPC(pc) - testName := strings.Split(funcValue.Name(), ".")[2] - It(testName, Label("SOLO"), func(ctx SpecContext) { - s.log(testName + ": BEGIN") - test(&s) - }, SpecTimeout(suiteTimeout)) + for filename, tests := range tapSoloTests { + for _, test := range tests { + test := test + pc := reflect.ValueOf(test).Pointer() + funcValue := runtime.FuncForPC(pc) + testName := filename + "/" + strings.Split(funcValue.Name(), ".")[2] + It(testName, Label("SOLO"), func(ctx SpecContext) { + s.log(testName + ": BEGIN") + test(&s) + }, SpecTimeout(suiteTimeout)) + } } }) |