pkger/pkging/pkgtest/mkdir_all.go

29 lines
466 B
Go
Raw Normal View History

2019-11-01 23:08:10 +03:00
package pkgtest
2019-10-31 00:15:49 +03:00
import (
"testing"
"github.com/markbates/pkger/pkging"
"github.com/stretchr/testify/require"
)
func MkdirAllTest(t *testing.T, ref *Ref, pkg pkging.Pkger) {
r := require.New(t)
name := "/all/this/useless/beauty"
2019-10-31 00:15:49 +03:00
_, err := pkg.Stat(name)
2019-10-31 00:15:49 +03:00
r.Error(err)
r.NoError(pkg.MkdirAll(name, 0755))
2019-10-31 00:15:49 +03:00
f, err := pkg.Open(name)
r.NoError(err)
2019-10-31 00:15:49 +03:00
info, err := f.Stat()
r.NoError(err)
2019-10-31 00:15:49 +03:00
r.Equal("app:"+name, f.Name())
r.Equal("beauty", info.Name())
2019-10-31 00:15:49 +03:00
}