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

Delta Between Two Patch Sets: src/pkg/bufio/bufio_test.go

Issue 7038051: code review 7038051: src: Use bytes.Equal instead of bytes.Compare where pos... (Closed)
Left Patch Set: Created 11 years, 2 months ago
Right Patch Set: diff -r be6ca9f6bfe8 https://code.google.com/p/go Created 11 years, 2 months 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:
Right: Side by side diff | Download
« no previous file with change/comment | « src/cmd/gofmt/long_test.go ('k') | src/pkg/crypto/rsa/pkcs1v15_test.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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 bufio_test 5 package bufio_test
6 6
7 import ( 7 import (
8 . "bufio" 8 . "bufio"
9 "bytes" 9 "bytes"
10 "fmt" 10 "fmt"
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 func TestReadLineNewlines(t *testing.T) { 741 func TestReadLineNewlines(t *testing.T) {
742 for _, e := range readLineNewlinesTests { 742 for _, e := range readLineNewlinesTests {
743 testReadLineNewlines(t, e.input, e.expect) 743 testReadLineNewlines(t, e.input, e.expect)
744 } 744 }
745 } 745 }
746 746
747 func testReadLineNewlines(t *testing.T, input string, expect []readLineResult) { 747 func testReadLineNewlines(t *testing.T, input string, expect []readLineResult) {
748 b := NewReaderSize(strings.NewReader(input), minReadBufferSize) 748 b := NewReaderSize(strings.NewReader(input), minReadBufferSize)
749 for i, e := range expect { 749 for i, e := range expect {
750 line, isPrefix, err := b.ReadLine() 750 line, isPrefix, err := b.ReadLine()
751 » » if bytes.Compare(line, e.line) != 0 { 751 » » if !bytes.Equal(line, e.line) {
752 t.Errorf("%q call %d, line == %q, want %q", input, i, li ne, e.line) 752 t.Errorf("%q call %d, line == %q, want %q", input, i, li ne, e.line)
753 return 753 return
754 } 754 }
755 if isPrefix != e.isPrefix { 755 if isPrefix != e.isPrefix {
756 t.Errorf("%q call %d, isPrefix == %v, want %v", input, i , isPrefix, e.isPrefix) 756 t.Errorf("%q call %d, isPrefix == %v, want %v", input, i , isPrefix, e.isPrefix)
757 return 757 return
758 } 758 }
759 if err != e.err { 759 if err != e.err {
760 t.Errorf("%q call %d, err == %v, want %v", input, i, err , e.err) 760 t.Errorf("%q call %d, err == %v, want %v", input, i, err , e.err)
761 return 761 return
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 1035
1036 func BenchmarkWriterCopyNoReadFrom(b *testing.B) { 1036 func BenchmarkWriterCopyNoReadFrom(b *testing.B) {
1037 for i := 0; i < b.N; i++ { 1037 for i := 0; i < b.N; i++ {
1038 b.StopTimer() 1038 b.StopTimer()
1039 src := onlyReader{bytes.NewBuffer(make([]byte, 8192))} 1039 src := onlyReader{bytes.NewBuffer(make([]byte, 8192))}
1040 dst := onlyWriter{NewWriter(new(bytes.Buffer))} 1040 dst := onlyWriter{NewWriter(new(bytes.Buffer))}
1041 b.StartTimer() 1041 b.StartTimer()
1042 io.Copy(dst, src) 1042 io.Copy(dst, src)
1043 } 1043 }
1044 } 1044 }
LEFTRIGHT

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