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

Delta Between Two Patch Sets: src/pkg/strings/strings_test.go

Issue 170046: code review 170046: Added a few more tests suggested by rsc to strings_test... (Closed)
Left Patch Set: code review 170046: Added a few more tests suggested by rsc to strings_test... Created 15 years, 3 months ago
Right Patch Set: code review 170046: bytes, strings: add new function Fields Created 15 years, 3 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/strings/strings.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 strings_test 5 package strings_test
6 6
7 import ( 7 import (
8 . "strings"; 8 . "strings";
9 "testing"; 9 "testing";
10 "unicode"; 10 "unicode";
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 179 }
180 } 180 }
181 } 181 }
182 182
183 type FieldsTest struct { 183 type FieldsTest struct {
184 s string; 184 s string;
185 a []string; 185 a []string;
186 } 186 }
187 187
188 var fieldstests = []FieldsTest{ 188 var fieldstests = []FieldsTest{
189 FieldsTest{"1 2 3 4", []string{"1", "2", "3", "4"}},
190 FieldsTest{"1 2 3 4", []string{"1", "2", "3", "4"}},
191 FieldsTest{"", []string{}}, 189 FieldsTest{"", []string{}},
192 FieldsTest{" ", []string{}}, 190 FieldsTest{" ", []string{}},
193 FieldsTest{" \t ", []string{}}, 191 FieldsTest{" \t ", []string{}},
194 FieldsTest{" abc ", []string{"abc"}}, 192 FieldsTest{" abc ", []string{"abc"}},
193 FieldsTest{"1 2 3 4", []string{"1", "2", "3", "4"}},
194 FieldsTest{"1 2 3 4", []string{"1", "2", "3", "4"}},
195 FieldsTest{"1\t\t2\t\t3\t4", []string{"1", "2", "3", "4"}}, 195 FieldsTest{"1\t\t2\t\t3\t4", []string{"1", "2", "3", "4"}},
196 FieldsTest{"1\u20002\u20013\u20024", []string{"1", "2", "3", "4"}}, 196 FieldsTest{"1\u20002\u20013\u20024", []string{"1", "2", "3", "4"}},
197 FieldsTest{"\u2000\u2001\u2002", []string{}}, 197 FieldsTest{"\u2000\u2001\u2002", []string{}},
198 FieldsTest{"\n™\t™\n", []string{"™", "™"}}, 198 FieldsTest{"\n™\t™\n", []string{"™", "™"}},
199 FieldsTest{faces, []string{faces}}, 199 FieldsTest{faces, []string{faces}},
200 } 200 }
201 201
202 func TestFields(t *testing.T) { 202 func TestFields(t *testing.T) {
203 for _, tt := range fieldstests { 203 for _, tt := range fieldstests {
204 a := Fields(tt.s); 204 a := Fields(tt.s);
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 } 451 }
452 if !tt.lossy { 452 if !tt.lossy {
453 // can only test reassembly if we didn't lose informatio n 453 // can only test reassembly if we didn't lose informatio n
454 s := string(a); 454 s := string(a);
455 if s != tt.in { 455 if s != tt.in {
456 t.Errorf("string(Runes(%q)) = %x; want %x", tt.i n, s, tt.in) 456 t.Errorf("string(Runes(%q)) = %x; want %x", tt.i n, s, tt.in)
457 } 457 }
458 } 458 }
459 } 459 }
460 } 460 }
LEFTRIGHT

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