forked from mirror/afero
Merge pull request #93 from moorereason/no-defer-on-err
Immediately check for errors on fs.Open
This commit is contained in:
commit
20500e2abd
|
@ -394,13 +394,13 @@ func TestWriteAt(t *testing.T) {
|
|||
}
|
||||
|
||||
f2, err := fs.Open(f.Name())
|
||||
if err != nil {
|
||||
t.Fatalf("%v: ReadFile %s: %v", fs.Name(), f.Name(), err)
|
||||
}
|
||||
defer f2.Close()
|
||||
buf := new(bytes.Buffer)
|
||||
buf.ReadFrom(f2)
|
||||
b := buf.Bytes()
|
||||
if err != nil {
|
||||
t.Fatalf("%v: ReadFile %s: %v", fs.Name(), f.Name(), err)
|
||||
}
|
||||
if string(b) != "hello, WORLD\n" {
|
||||
t.Fatalf("after write: have %q want %q", string(b), "hello, WORLD\n")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue