summaryrefslogtreecommitdiff
path: root/libgo/go/bytes/reader_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/bytes/reader_test.go')
-rw-r--r--libgo/go/bytes/reader_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/libgo/go/bytes/reader_test.go b/libgo/go/bytes/reader_test.go
index d3dce53499e..b929a282609 100644
--- a/libgo/go/bytes/reader_test.go
+++ b/libgo/go/bytes/reader_test.go
@@ -244,3 +244,15 @@ func TestReaderCopyNothing(t *testing.T) {
t.Errorf("behavior differs: with = %#v; without: %#v", with, withOut)
}
}
+
+// tests that Len is affected by reads, but Size is not.
+func TestReaderLenSize(t *testing.T) {
+ r := NewReader([]byte("abc"))
+ io.CopyN(ioutil.Discard, r, 1)
+ if r.Len() != 2 {
+ t.Errorf("Len = %d; want 2", r.Len())
+ }
+ if r.Size() != 3 {
+ t.Errorf("Size = %d; want 3", r.Size())
+ }
+}