diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2019-03-07 09:13:32 -0500 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2019-03-07 09:13:32 -0500 |
| commit | d16298ea4fc8bcbf16a023a6a9b9f3b48bb3e9e2 (patch) | |
| tree | 9c7adad5d872b1ff9f9298403b1de2795de04e1a /data/datasource_test.go | |
| parent | 3bc0bb968836bb19389200e935b82670ea64d75d (diff) | |
Replacing uses of blang/vfs with spf13/afero
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'data/datasource_test.go')
| -rw-r--r-- | data/datasource_test.go | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/data/datasource_test.go b/data/datasource_test.go index ea0eb719..ee6c6acf 100644 --- a/data/datasource_test.go +++ b/data/datasource_test.go @@ -7,8 +7,8 @@ import ( "strings" "testing" - "github.com/blang/vfs" - "github.com/blang/vfs/memfs" + "github.com/spf13/afero" + "github.com/stretchr/testify/assert" ) @@ -97,17 +97,17 @@ func TestParseSourceWithAlias(t *testing.T) { func TestDatasource(t *testing.T) { setup := func(ext, mime string, contents []byte) *Data { fname := "foo." + ext - fs := memfs.Create() + fs := afero.NewMemMapFs() var uPath string - var f vfs.File + var f afero.File if runtime.GOOS == "windows" { _ = fs.Mkdir("C:\\tmp", 0777) - f, _ = vfs.Create(fs, "C:\\tmp\\"+fname) + f, _ = fs.Create("C:\\tmp\\" + fname) _, _ = f.Write(contents) uPath = "C:/tmp/" + fname } else { _ = fs.Mkdir("/tmp", 0777) - f, _ = vfs.Create(fs, "/tmp/"+fname) + f, _ = fs.Create("/tmp/" + fname) uPath = "/tmp/" + fname } _, _ = f.Write(contents) @@ -144,16 +144,16 @@ func TestDatasource(t *testing.T) { func TestDatasourceReachable(t *testing.T) { fname := "foo.json" - fs := memfs.Create() + fs := afero.NewMemMapFs() var uPath string - var f vfs.File + var f afero.File if runtime.GOOS == "windows" { _ = fs.Mkdir("C:\\tmp", 0777) - f, _ = vfs.Create(fs, "C:\\tmp\\"+fname) + f, _ = fs.Create("C:\\tmp\\" + fname) uPath = "C:/tmp/" + fname } else { _ = fs.Mkdir("/tmp", 0777) - f, _ = vfs.Create(fs, "/tmp/"+fname) + f, _ = fs.Create("/tmp/" + fname) uPath = "/tmp/" + fname } _, _ = f.Write([]byte("{}")) @@ -190,20 +190,17 @@ func TestInclude(t *testing.T) { ext := "txt" contents := "hello world" fname := "foo." + ext - fs := memfs.Create() - // _ = fs.Mkdir("/tmp", 0777) - // f, _ := vfs.Create(fs, "/tmp/"+fname) - // _, _ = f.Write([]byte(contents)) + fs := afero.NewMemMapFs() var uPath string - var f vfs.File + var f afero.File if runtime.GOOS == "windows" { _ = fs.Mkdir("C:\\tmp", 0777) - f, _ = vfs.Create(fs, "C:\\tmp\\"+fname) + f, _ = fs.Create("C:\\tmp\\" + fname) uPath = "C:/tmp/" + fname } else { _ = fs.Mkdir("/tmp", 0777) - f, _ = vfs.Create(fs, "/tmp/"+fname) + f, _ = fs.Create("/tmp/" + fname) uPath = "/tmp/" + fname } _, _ = f.Write([]byte(contents)) |
