diff options
Diffstat (limited to 'libgo/go/encoding/csv/reader_test.go')
-rw-r--r-- | libgo/go/encoding/csv/reader_test.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libgo/go/encoding/csv/reader_test.go b/libgo/go/encoding/csv/reader_test.go index 123df06bc85..be1002d034a 100644 --- a/libgo/go/encoding/csv/reader_test.go +++ b/libgo/go/encoding/csv/reader_test.go @@ -87,6 +87,15 @@ field"`, }, }, { + Name: "BlankLineFieldCount", + Input: "a,b,c\n\nd,e,f\n\n", + UseFieldsPerRecord: true, + Output: [][]string{ + {"a", "b", "c"}, + {"d", "e", "f"}, + }, + }, + { Name: "TrimSpace", Input: " a, b, c\n", TrimLeadingSpace: true, @@ -282,3 +291,25 @@ func TestRead(t *testing.T) { } } } + +func BenchmarkRead(b *testing.B) { + data := `x,y,z,w +x,y,z, +x,y,, +x,,, +,,, +"x","y","z","w" +"x","y","z","" +"x","y","","" +"x","","","" +"","","","" +` + + for i := 0; i < b.N; i++ { + _, err := NewReader(strings.NewReader(data)).ReadAll() + + if err != nil { + b.Fatalf("could not read data: %s", err) + } + } +} |