25 lines
408 B
Go
25 lines
408 B
Go
|
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
|
||
|
package fixtures
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
type Test func(t *testing.T)
|
||
|
|
||
|
type Tester interface {
|
||
|
Test(t *testing.T)
|
||
|
RunWith(t *testing.T, f []Ft)
|
||
|
}
|
||
|
|
||
|
func (tf Test) Test(t *testing.T) {
|
||
|
tf(t)
|
||
|
}
|
||
|
|
||
|
func (tf Test) RunWith(t *testing.T, f []Ft) {
|
||
|
for i, fixture := range(f) {
|
||
|
t.Run(t.Name() + strconv.Itoa(i), tf)
|
||
|
}
|
||
|
}
|
||
|
|