Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(25)

Delta Between Two Patch Sets: src/pkg/bytes/buffer_test.go

Issue 4000046: code review 4000046: bytes: Add Buffer.ReadBytes, Buffer.ReadString (Closed)
Left Patch Set: code review 4000046: bytes: Add Buffer.ReadBytes, Buffer.ReadString Created 14 years, 1 month ago
Right Patch Set: code review 4000046: bytes: Add Buffer.ReadBytes, Buffer.ReadString Created 14 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/bytes/buffer.go ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package bytes_test 5 package bytes_test
6 6
7 import ( 7 import (
8 . "bytes" 8 . "bytes"
9 "os" 9 "os"
10 "rand" 10 "rand"
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 }{ 357 }{
358 {err: os.EOF}, 358 {err: os.EOF},
359 {[]byte{}, 0, []byte{}, os.EOF}, 359 {[]byte{}, 0, []byte{}, os.EOF},
360 {[]byte("a\x00"), 0, []byte("a\x00"), nil}, 360 {[]byte("a\x00"), 0, []byte("a\x00"), nil},
361 {[]byte("hello\x01world"), 1, []byte("hello\x01"), nil}, 361 {[]byte("hello\x01world"), 1, []byte("hello\x01"), nil},
362 {[]byte("foo\nbar"), 0, []byte("foo\nbar"), os.EOF}, 362 {[]byte("foo\nbar"), 0, []byte("foo\nbar"), os.EOF},
363 {[]byte("alpha beta gamma"), ' ', []byte("alpha "), nil}, 363 {[]byte("alpha beta gamma"), ' ', []byte("alpha "), nil},
364 } 364 }
365 365
366 func TestReadBytes(t *testing.T) { 366 func TestReadBytes(t *testing.T) {
367 » for i, test := range readBytesTests { 367 » for _, test := range readBytesTests {
368 buf := NewBuffer(test.buffer) 368 buf := NewBuffer(test.buffer)
369 bytes, err := buf.ReadBytes(test.delim) 369 bytes, err := buf.ReadBytes(test.delim)
370 if !Equal(bytes, test.expected) || err != test.err { 370 if !Equal(bytes, test.expected) || err != test.err {
371 » » » t.Errorf("%d expected %q, %v got %q, %v", i, test.expect ed, test.err, bytes, err) 371 » » » t.Errorf("expected %q, %v got %q, %v", test.expected, te st.err, bytes, err)
r 2011/01/26 18:30:11 you can drop the test number - it adds little and
372 » » } 372 » » }
373 » } 373 » }
374 } 374 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b