pkger/pkging/costello/walk.go

37 lines
601 B
Go
Raw Normal View History

package costello
2019-10-31 00:32:47 +03:00
import (
"os"
"testing"
"github.com/markbates/pkger/pkging"
"github.com/stretchr/testify/require"
)
func WalkTest(t *testing.T, ref *Ref, pkg pkging.Pkger) {
r := require.New(t)
2019-11-01 00:20:15 +03:00
exp, err := LoadFiles("/public", ref, pkg)
r.NoError(err)
defer os.RemoveAll(ref.Dir)
2019-10-31 00:32:47 +03:00
name := "public"
var act []os.FileInfo
err = pkg.Walk("/"+name, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
act = append(act, info)
return nil
})
r.NoError(err)
r.Len(act, len(exp))
for i, info := range exp {
cmpFileInfo(t, info, act[i])
}
}