summaryrefslogtreecommitdiff
path: root/libgo/go/bytes/buffer_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/bytes/buffer_test.go')
-rw-r--r--libgo/go/bytes/buffer_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/libgo/go/bytes/buffer_test.go b/libgo/go/bytes/buffer_test.go
index adb93302a54..d0af11f104b 100644
--- a/libgo/go/bytes/buffer_test.go
+++ b/libgo/go/bytes/buffer_test.go
@@ -373,3 +373,16 @@ func TestReadBytes(t *testing.T) {
}
}
}
+
+// Was a bug: used to give EOF reading empty slice at EOF.
+func TestReadEmptyAtEOF(t *testing.T) {
+ b := new(Buffer)
+ slice := make([]byte, 0)
+ n, err := b.Read(slice)
+ if err != nil {
+ t.Errorf("read error: %v", err)
+ }
+ if n != 0 {
+ t.Errorf("wrong count; got %d want 0", n)
+ }
+}