Add test for LoadAll with too large buffer

LoadAll() should not pass on io.ErrUnexpectedEOF, since the occurrence
of this error is normal.
This commit is contained in:
Alexander Neumann
2016-02-07 23:48:03 +01:00
parent 57a24b2cdf
commit a37ed45534
2 changed files with 63 additions and 0 deletions

View File

@@ -245,6 +245,17 @@ func TestLoad(t testing.TB) {
}
}
// load with a too-large buffer, this should return io.ErrUnexpectedEOF
buf := make([]byte, length+100)
n, err := b.Load(handle, buf, 0)
if n != length {
t.Errorf("wrong length for larger buffer returned, want %d, got %d", length, n)
}
if err != io.ErrUnexpectedEOF {
t.Errorf("wrong error returned for larger buffer: want io.ErrUnexpectedEOF, got %#v", err)
}
OK(t, b.Remove(backend.Data, id.String()))
}