bytes, strings: add (*Reader).WriteTo

Fixes #4031.

R=golang-dev, bradfitz, remyoudompheng, r, dave
CC=golang-dev
https://golang.org/cl/6632046
This commit is contained in:
Evan Shaw 2012-10-12 14:43:50 +11:00 committed by Rob Pike
parent 06d42690b6
commit eae25d430d
5 changed files with 86 additions and 4 deletions

View file

@ -251,10 +251,10 @@ func TestReadFrom(t *testing.T) {
func TestWriteTo(t *testing.T) {
var buf Buffer
for i := 3; i < 30; i += 3 {
s := fillBytes(t, "TestReadFrom (1)", &buf, "", 5, testBytes[0:len(testBytes)/i])
s := fillBytes(t, "TestWriteTo (1)", &buf, "", 5, testBytes[0:len(testBytes)/i])
var b Buffer
buf.WriteTo(&b)
empty(t, "TestReadFrom (2)", &b, s, make([]byte, len(data)))
empty(t, "TestWriteTo (2)", &b, s, make([]byte, len(data)))
}
}