pkger/pkging/stdos/stdos_test.go

35 lines
664 B
Go
Raw Normal View History

package stdos
2019-09-02 01:02:45 +03:00
import (
2019-09-12 04:29:39 +03:00
"io/ioutil"
"path/filepath"
2019-09-02 01:02:45 +03:00
"testing"
"github.com/markbates/pkger/here"
2019-09-12 04:29:39 +03:00
"github.com/markbates/pkger/pkging"
"github.com/markbates/pkger/pkging/costello"
2019-09-02 01:02:45 +03:00
)
func NewTemp(ref *costello.Ref) (pkging.Pkger, error) {
dir, err := ioutil.TempDir("", "stdos")
2019-09-12 04:29:39 +03:00
if err != nil {
return nil, err
2019-09-12 04:29:39 +03:00
}
2019-09-02 01:02:45 +03:00
info := here.Info{
Module: ref.Module,
ImportPath: ref.ImportPath,
Name: ref.Name,
Dir: dir,
}
info.Module.Dir = dir
info.Module.GoMod = filepath.Join(dir, "go.mod")
return New(info)
}
func Test_Pkger(t *testing.T) {
costello.All(t, func(ref *costello.Ref) (pkging.Pkger, error) {
return NewTemp(ref)
})
2019-09-02 01:02:45 +03:00
}