2019-10-26 00:11:34 +03:00
|
|
|
package costello
|
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)
|
|
|
|
|
2019-10-31 18:06:20 +03:00
|
|
|
name := "/all/this/useless/beauty"
|
2019-10-31 00:15:49 +03:00
|
|
|
|
2019-10-31 18:06:20 +03:00
|
|
|
_, err := pkg.Stat(name)
|
2019-10-31 00:15:49 +03:00
|
|
|
r.Error(err)
|
|
|
|
|
2019-10-31 18:06:20 +03:00
|
|
|
r.NoError(pkg.MkdirAll(name, 0755))
|
2019-10-31 00:15:49 +03:00
|
|
|
|
2019-10-31 18:06:20 +03:00
|
|
|
f, err := pkg.Open(name)
|
|
|
|
r.NoError(err)
|
2019-10-31 00:15:49 +03:00
|
|
|
|
2019-10-31 18:06:20 +03:00
|
|
|
info, err := f.Stat()
|
|
|
|
r.NoError(err)
|
2019-10-31 00:15:49 +03:00
|
|
|
|
2019-10-31 18:06:20 +03:00
|
|
|
r.Equal("app:"+name, f.Name())
|
|
|
|
r.Equal("beauty", info.Name())
|
2019-10-31 00:15:49 +03:00
|
|
|
}
|