2019-09-20 17:56:26 +03:00
|
|
|
package stdos
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2019-10-09 20:21:54 +03:00
|
|
|
"github.com/markbates/pkger/here"
|
2019-09-20 17:56:26 +03:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Test_File_Stat_No_Info(t *testing.T) {
|
|
|
|
r := require.New(t)
|
|
|
|
|
2019-10-09 20:21:54 +03:00
|
|
|
her, err := here.Current()
|
|
|
|
r.NoError(err)
|
|
|
|
pkg, err := New(her)
|
2019-09-20 17:56:26 +03:00
|
|
|
r.NoError(err)
|
|
|
|
|
|
|
|
f, err := pkg.Open(":/pkging/stdos/file_test.go")
|
|
|
|
r.NoError(err)
|
|
|
|
defer f.Close()
|
|
|
|
|
|
|
|
sf, ok := f.(*File)
|
|
|
|
r.True(ok)
|
|
|
|
|
|
|
|
oi := sf.info
|
|
|
|
sf.info = nil
|
|
|
|
|
|
|
|
info, err := sf.Stat()
|
|
|
|
r.NoError(err)
|
|
|
|
r.Equal(oi.Name(), info.Name())
|
|
|
|
// r.Equal("", f.Name())
|
|
|
|
}
|