Skip to content

Commit

Permalink
Merge branch 'jonasi-patch-1'
Browse files Browse the repository at this point in the history
  • Loading branch information
djherbis committed Apr 13, 2020
2 parents 668a316 + a5c3d9a commit c873af4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (r *Reader) read(p []byte, off *int64) (n int, err error) {
*off += int64(m)

switch {
case n != 0 && err == nil:
case n != 0 && (err == nil || err == io.EOF):
return n, nil

case err == io.EOF:
Expand Down
9 changes: 5 additions & 4 deletions stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,13 +452,14 @@ func testReadAtWait(t *testing.T, fs FileSystem) {
io.WriteString(f, " world")
f.Close()
}()
data := make([]byte, 11)
_, err = r.ReadAt(data, 0)
data := make([]byte, 5)
_, err = r.ReadAt(data, 6)
if err != nil {
t.Error(err)
}
if string(data) != "hello world" {
t.Error("expected to read 'hello world' got ", string(data))
want := "world"
if string(data) != want {
t.Errorf("expected to read %q got %q", want, string(data))
}
}

Expand Down

0 comments on commit c873af4

Please sign in to comment.