40 lines
617 B
Go
40 lines
617 B
Go
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
|
|
package fixtures
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
// fixture set type
|
|
type Ft func(t *testing.T, input interface{}) []interface{}
|
|
|
|
// Defines a fixture which can return a slice of values
|
|
type F struct {
|
|
name string
|
|
func []Getter
|
|
}
|
|
|
|
func (f *F) AddGetter(ft Getter) {
|
|
append(f.func, ft)
|
|
}
|
|
|
|
|
|
type Ft func(t *testing.T) interface{}
|
|
|
|
func (f *Ft) Get(t *testing.T) {
|
|
return f(t)
|
|
}
|
|
|
|
// Getter interface
|
|
type Getter interface {
|
|
Get() interface{}
|
|
}
|
|
|
|
type F struct {
|
|
*testing.T
|
|
}
|
|
|
|
func (f *F) RunWith(t *testing.T, data interface{}) {
|
|
|
|
}
|