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

Side by Side Diff: src/pkg/strings/strings_test.go

Issue 5294074: code review 5294074: src/pkg/[n-z]*: gofix -r error (Closed)
Patch Set: diff -r b78bb4f2d2a3 https://go.googlecode.com/hg/ Created 13 years, 4 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:
View unified diff | Download patch
« no previous file with comments | « src/pkg/strings/replace.go ('k') | src/pkg/syscall/dll_windows.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 strings_test 5 package strings_test
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 » "os" 9 » "io"
10 "reflect" 10 "reflect"
11 "strconv" 11 "strconv"
12 . "strings" 12 . "strings"
13 "testing" 13 "testing"
14 "unicode" 14 "unicode"
15 "unsafe" 15 "unsafe"
16 "utf8" 16 "utf8"
17 ) 17 )
18 18
19 func eq(a, b []string) bool { 19 func eq(a, b []string) bool {
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 func TestReadByte(t *testing.T) { 752 func TestReadByte(t *testing.T) {
753 testStrings := []string{"", abcd, faces, commas} 753 testStrings := []string{"", abcd, faces, commas}
754 for _, s := range testStrings { 754 for _, s := range testStrings {
755 reader := NewReader(s) 755 reader := NewReader(s)
756 if e := reader.UnreadByte(); e == nil { 756 if e := reader.UnreadByte(); e == nil {
757 t.Errorf("Unreading %q at beginning: expected error", s) 757 t.Errorf("Unreading %q at beginning: expected error", s)
758 } 758 }
759 var res bytes.Buffer 759 var res bytes.Buffer
760 for { 760 for {
761 b, e := reader.ReadByte() 761 b, e := reader.ReadByte()
762 » » » if e == os.EOF { 762 » » » if e == io.EOF {
763 break 763 break
764 } 764 }
765 if e != nil { 765 if e != nil {
766 t.Errorf("Reading %q: %s", s, e) 766 t.Errorf("Reading %q: %s", s, e)
767 break 767 break
768 } 768 }
769 res.WriteByte(b) 769 res.WriteByte(b)
770 // unread and read again 770 // unread and read again
771 e = reader.UnreadByte() 771 e = reader.UnreadByte()
772 if e != nil { 772 if e != nil {
(...skipping 19 matching lines...) Expand all
792 func TestReadRune(t *testing.T) { 792 func TestReadRune(t *testing.T) {
793 testStrings := []string{"", abcd, faces, commas} 793 testStrings := []string{"", abcd, faces, commas}
794 for _, s := range testStrings { 794 for _, s := range testStrings {
795 reader := NewReader(s) 795 reader := NewReader(s)
796 if e := reader.UnreadRune(); e == nil { 796 if e := reader.UnreadRune(); e == nil {
797 t.Errorf("Unreading %q at beginning: expected error", s) 797 t.Errorf("Unreading %q at beginning: expected error", s)
798 } 798 }
799 res := "" 799 res := ""
800 for { 800 for {
801 r, z, e := reader.ReadRune() 801 r, z, e := reader.ReadRune()
802 » » » if e == os.EOF { 802 » » » if e == io.EOF {
803 break 803 break
804 } 804 }
805 if e != nil { 805 if e != nil {
806 t.Errorf("Reading %q: %s", s, e) 806 t.Errorf("Reading %q: %s", s, e)
807 break 807 break
808 } 808 }
809 res += string(r) 809 res += string(r)
810 // unread and read again 810 // unread and read again
811 e = reader.UnreadRune() 811 e = reader.UnreadRune()
812 if e != nil { 812 if e != nil {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 func TestEqualFold(t *testing.T) { 927 func TestEqualFold(t *testing.T) {
928 for _, tt := range EqualFoldTests { 928 for _, tt := range EqualFoldTests {
929 if out := EqualFold(tt.s, tt.t); out != tt.out { 929 if out := EqualFold(tt.s, tt.t); out != tt.out {
930 t.Errorf("EqualFold(%#q, %#q) = %v, want %v", tt.s, tt.t , out, tt.out) 930 t.Errorf("EqualFold(%#q, %#q) = %v, want %v", tt.s, tt.t , out, tt.out)
931 } 931 }
932 if out := EqualFold(tt.t, tt.s); out != tt.out { 932 if out := EqualFold(tt.t, tt.s); out != tt.out {
933 t.Errorf("EqualFold(%#q, %#q) = %v, want %v", tt.t, tt.s , out, tt.out) 933 t.Errorf("EqualFold(%#q, %#q) = %v, want %v", tt.t, tt.s , out, tt.out)
934 } 934 }
935 } 935 }
936 } 936 }
OLDNEW
« no previous file with comments | « src/pkg/strings/replace.go ('k') | src/pkg/syscall/dll_windows.go » ('j') | no next file with comments »

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