Use the Afero source fs where relevant

Fixes #2319
This commit is contained in:
Bjørn Erik Pedersen
2016-07-30 15:37:03 +02:00
parent a0859dc672
commit 4ddd5361c1
4 changed files with 13 additions and 34 deletions

View File

@@ -16,7 +16,6 @@ package source
import (
"bytes"
"io"
"io/ioutil"
"os"
"testing"
@@ -60,7 +59,7 @@ func TestRead(t *testing.T) {
b, err := afero.ReadFile(fs, filename)
if err != nil {
t.Fatalf("ioutil.ReadFile: %v", err)
t.Fatalf("afero.ReadFile: %v", err)
}
rd, err := NewLazyFileReader(fs, filename)
@@ -101,7 +100,7 @@ func TestSeek(t *testing.T) {
filename := "lazy_file_reader_test.go"
b, err := afero.ReadFile(fs, filename)
if err != nil {
t.Fatalf("ioutil.ReadFile: %v", err)
t.Fatalf("afero.ReadFile: %v", err)
}
// no cache case
@@ -192,14 +191,14 @@ func TestSeek(t *testing.T) {
func TestWriteTo(t *testing.T) {
fs := afero.NewOsFs()
filename := "lazy_file_reader_test.go"
fi, err := os.Stat(filename)
fi, err := fs.Stat(filename)
if err != nil {
t.Fatalf("os.Stat: %v", err)
}
b, err := ioutil.ReadFile(filename)
b, err := afero.ReadFile(fs, filename)
if err != nil {
t.Fatalf("ioutil.ReadFile: %v", err)
t.Fatalf("afero.ReadFile: %v", err)
}
rd, err := NewLazyFileReader(fs, filename)