pkger/pkging/costello/costello.go

35 lines
541 B
Go
Raw Normal View History

package costello
import (
2019-10-30 23:39:05 +03:00
"testing"
"github.com/markbates/pkger/pkging"
2019-10-30 23:39:05 +03:00
"github.com/stretchr/testify/require"
)
2019-10-30 23:39:05 +03:00
type AllFn func(ref *Ref) (pkging.Pkger, error)
func All(t *testing.T, fn AllFn) {
r := require.New(t)
type tf func(*testing.T, pkging.Pkger)
tests := map[string]tf{
2019-10-30 23:49:55 +03:00
"OpenTest": OpenTest,
"StatTest": StatTest,
"CreateTest": CreateTest,
2019-10-30 23:39:05 +03:00
}
ref, err := NewRef()
r.NoError(err)
for n, tt := range tests {
t.Run(n, func(st *testing.T) {
pkg, err := fn(ref)
r.NoError(err)
tt(st, pkg)
})
}
}