1
0
mirror of https://github.com/golang/go synced 2024-11-05 20:36:10 -07:00

io: check n in testReadAtLeast

Change-Id: I53859d4d3c729cce9f73b14dc2dd8571f7e7ffb3
Reviewed-on: https://go-review.googlesource.com/c/go/+/216457
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Davor Kapsa 2020-01-25 14:40:10 +01:00 committed by Robert Griesemer
parent 7f41a009a6
commit 753011ebc3

View File

@ -285,6 +285,9 @@ func testReadAtLeast(t *testing.T, rb ReadWriter) {
if err != nil {
t.Error(err)
}
if n != 2 {
t.Errorf("expected to have read 2 bytes, got %v", n)
}
n, err = ReadAtLeast(rb, buf, 4)
if err != ErrShortBuffer {
t.Errorf("expected ErrShortBuffer got %v", err)