humble daisy

This commit is contained in:
Mark Bates 2019-09-02 12:57:18 -04:00
parent 5d76c9af09
commit c3ae1d1bda
1 changed files with 42 additions and 4 deletions

View File

@ -302,10 +302,6 @@ func (s Suite) Test_Parse(t *testing.T) {
}
}
func (s Suite) Test_ReadFile(t *testing.T) {
panic("not implemented")
}
func (s Suite) Test_Stat_Error(t *testing.T) {
r := require.New(t)
@ -420,3 +416,45 @@ func (s Suite) Test_Stat_File(t *testing.T) {
func (s Suite) Test_Walk(t *testing.T) {
panic("not implemented")
}
func (s Suite) Test_ReadFile(t *testing.T) {
r := require.New(t)
cur, err := s.Current()
r.NoError(err)
ip := cur.ImportPath
table := []struct {
in string
}{
{in: mould},
{in: ":" + mould},
{in: ip + ":" + mould},
{in: hart},
}
for _, tt := range table {
t.Run(tt.in, func(st *testing.T) {
r := require.New(st)
pt, err := s.Parse(tt.in)
r.NoError(err)
r.NoError(s.RemoveAll(pt.String()))
r.NoError(s.MkdirAll(filepath.Dir(pt.Name), 0755))
f, err := s.Create(tt.in)
r.NoError(err)
body := "!" + pt.String()
_, err = io.Copy(f, strings.NewReader(body))
r.NoError(err)
r.NoError(f.Close())
b, err := s.ReadFile(tt.in)
r.NoError(err)
r.Equal(body, string(b))
})
}
}