2019-10-26 00:11:34 +03:00
|
|
|
package costello
|
2019-10-30 20:05:35 +03:00
|
|
|
|
|
|
|
import (
|
2019-10-30 23:39:05 +03:00
|
|
|
"testing"
|
2019-10-30 20:05:35 +03:00
|
|
|
|
|
|
|
"github.com/markbates/pkger/pkging"
|
2019-10-30 23:39:05 +03:00
|
|
|
"github.com/stretchr/testify/require"
|
2019-10-30 20:05:35 +03:00
|
|
|
)
|
|
|
|
|
2019-10-30 23:39:05 +03:00
|
|
|
type AllFn func(ref *Ref) (pkging.Pkger, error)
|
|
|
|
|
2019-10-30 23:56:22 +03:00
|
|
|
func All(t *testing.T, ref *Ref, fn AllFn) {
|
2019-10-30 23:39:05 +03:00
|
|
|
r := require.New(t)
|
2019-10-30 23:56:22 +03:00
|
|
|
|
|
|
|
type tf func(*testing.T, *Ref, pkging.Pkger)
|
2019-10-30 23:39:05 +03:00
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
for n, tt := range tests {
|
|
|
|
t.Run(n, func(st *testing.T) {
|
|
|
|
pkg, err := fn(ref)
|
|
|
|
r.NoError(err)
|
|
|
|
|
2019-10-30 23:56:22 +03:00
|
|
|
tt(st, ref, pkg)
|
2019-10-30 23:39:05 +03:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2019-10-30 20:05:35 +03:00
|
|
|
}
|