testing/fixtures/tester.go

25 lines
408 B
Go
Raw Normal View History

2024-05-08 20:28:36 +00:00
// 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)
}
}