testing/fixtures/tester.go

28 lines
415 B
Go
Raw Permalink Normal View History

2024-05-08 20:28:36 +00:00
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
2024-05-08 21:32:31 +00:00
2024-05-08 20:28:36 +00:00
package fixtures
2024-05-08 21:32:31 +00:00
/*
2024-05-08 20:28:36 +00:00
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)
}
}
2024-05-08 21:32:31 +00:00
*/