(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestPreprocess(t *testing.T) { |
| 14 | const input = ` |
| 15 | ,, |
| 16 | "","","" |
| 17 | """","""","""" |
| 18 | field1,"field"2,field"3" my friend |
| 19 | field4,"field"5 with "multiple" quotes "to" escape,field6 |
| 20 | """,""",""" has a couple "" embedded quotes and a , comma",""" """ |
| 21 | x,"hello, |
| 22 | "" world , " foo,y |
| 23 | field1,field2,"test eof with quotes"` |
| 24 | const expected = ` |
| 25 | ,, |
| 26 | "","","" |
| 27 | """","""","""" |
| 28 | field1,"field2","field3 my friend" |
| 29 | field4,"field5 with multiple quotes to escape",field6 |
| 30 | """,""",""" has a couple "" embedded quotes and a , comma",""" """ |
| 31 | x,"hello, |
| 32 | "" world , foo",y |
| 33 | field1,field2,"test eof with quotes"` |
| 34 | |
| 35 | p := newPreprocess(strings.NewReader(input), ',') |
| 36 | var buf bytes.Buffer |
| 37 | _, err := io.Copy(&buf, p) |
| 38 | require.NoError(t, err) |
| 39 | assert.Equal(t, expected, buf.String()) |
| 40 | } |
nothing calls this directly
no test coverage detected