From f05a546d9e9b07d9afb48f1e838dbfa3b9b45644 Mon Sep 17 00:00:00 2001 From: Mark Bates Date: Sun, 1 Sep 2019 00:03:01 -0400 Subject: [PATCH] envying the irony that is rock and roll --- fs/fstest/suite.go | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/fs/fstest/suite.go b/fs/fstest/suite.go index 8071c67..3680248 100644 --- a/fs/fstest/suite.go +++ b/fs/fstest/suite.go @@ -125,7 +125,31 @@ func (s *FileSystem) Test_Open(t *testing.T) { } func (s *FileSystem) Test_Parse(t *testing.T) { - panic("not implemented") + r := require.New(t) + + cur, err := s.Current() + r.NoError(err) + + ip := cur.ImportPath + table := []struct { + in string + exp fs.Path + }{ + {in: "/foo.go", exp: fs.Path{Pkg: ip, Name: "/foo.go"}}, + {in: ":/foo.go", exp: fs.Path{Pkg: ip, Name: "/foo.go"}}, + {in: ip + ":/foo.go", exp: fs.Path{Pkg: ip, Name: "/foo.go"}}, + {in: ip, exp: fs.Path{Pkg: ip, Name: "/"}}, + } + + 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.Equal(tt.exp, pt) + }) + } } func (s *FileSystem) Test_ReadFile(t *testing.T) {