pkger/pkging/pkgtest/stat.go

26 lines
428 B
Go
Raw Normal View History

2019-11-01 23:08:10 +03:00
package pkgtest
2019-10-30 23:39:05 +03:00
import (
"os"
"path/filepath"
"testing"
"github.com/markbates/pkger/pkging"
"github.com/stretchr/testify/require"
)
func StatTest(t *testing.T, ref *Ref, pkg pkging.Pkger) {
2019-10-30 23:39:05 +03:00
r := require.New(t)
2019-11-01 22:53:54 +03:00
_, err := LoadFile("/go.mod", ref, pkg)
2019-10-30 23:39:05 +03:00
r.NoError(err)
2019-11-01 22:53:54 +03:00
osi, err := os.Stat(filepath.Join(ref.Dir, "go.mod"))
2019-11-01 00:20:15 +03:00
r.NoError(err)
2019-11-01 22:53:54 +03:00
2019-10-30 23:39:05 +03:00
psi, err := pkg.Stat("/go.mod")
r.NoError(err)
2019-11-01 22:53:54 +03:00
CmpFileInfo(t, osi, psi)
2019-10-30 23:39:05 +03:00
}