77 "runtime"
88 "strconv"
99 "strings"
10- "testing"
1110 "time"
1211
1312 "github.com/tkrop/go-testing/internal/maps"
@@ -130,7 +129,7 @@ type Factory[P any] interface {
130129// factory is a generic parameterized test factory struct.
131130type factory [P any ] struct {
132131 // The testing context to run the tests in.
133- t * testing. T
132+ t Test
134133 // A wait group to synchronize the test execution.
135134 wg sync.WaitGroup
136135 // The test parameter sets to run.
@@ -148,7 +147,7 @@ type factory[P any] struct {
148147// can be a single test parameter set, a slice of test parameter sets, or a map
149148// of named test parameter sets. The test runner is looking into the parameter
150149// set to determine a suitable test case name, e.g. by using a `name` parameter.
151- func Any [P any ](t * testing. T , params any ) Factory [P ] {
150+ func Any [P any ](t Test , params any ) Factory [P ] {
152151 t .Helper ()
153152
154153 return & factory [P ]{
@@ -161,7 +160,7 @@ func Any[P any](t *testing.T, params any) Factory[P] {
161160// Param creates a new parallel test runner with given test parameter sets
162161// provided as variadic arguments. The test runner is looking into the
163162// parameter set to find a suitable test case name.
164- func Param [P any ](t * testing. T , params ... P ) Factory [P ] {
163+ func Param [P any ](t Test , params ... P ) Factory [P ] {
165164 t .Helper ()
166165
167166 if len (params ) == 1 {
@@ -172,7 +171,7 @@ func Param[P any](t *testing.T, params ...P) Factory[P] {
172171
173172// Map creates a new parallel test runner with given test parameter sets
174173// provided as a test case name to parameter sets mapping.
175- func Map [P any ](t * testing. T , params ... map [string ]P ) Factory [P ] {
174+ func Map [P any ](t Test , params ... map [string ]P ) Factory [P ] {
176175 t .Helper ()
177176
178177 return Any [P ](t , maps .Add (maps .Copy (params [0 ]), params [1 :]... ))
@@ -181,7 +180,7 @@ func Map[P any](t *testing.T, params ...map[string]P) Factory[P] {
181180// Slice creates a new parallel test runner with given test parameter sets
182181// provided as a slice. The test runner is looking into the parameter set to
183182// find a suitable test case name.
184- func Slice [P any ](t * testing. T , params ... []P ) Factory [P ] {
183+ func Slice [P any ](t Test , params ... []P ) Factory [P ] {
185184 t .Helper ()
186185
187186 return Any [P ](t , slices .Add (params ... ))
@@ -297,16 +296,16 @@ func (r *factory[P]) exec(
297296 return
298297 }
299298
300- r . t . Run (name , r .wrap (param , call , parallel ))
299+ reflect . Run (r . t , name , r .wrap (param , call , parallel ))
301300}
302301
303302// wrap creates the wrapper method eventually executing the test.
304303func (r * factory [P ]) wrap (
305304 param P , call ParamFunc [P ], parallel bool ,
306- ) func (* testing. T ) {
305+ ) func (Test ) {
307306 r .wg .Add (1 )
308307
309- return func (t * testing. T ) {
308+ return func (t Test ) {
310309 t .Helper ()
311310
312311 New (t , parallel ).
0 commit comments