MCPcopy Create free account
hub / github.com/brimdata/super / TestPreprocess

Function TestPreprocess

sio/csvio/preprocess_test.go:13–40  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestPreprocess(t *testing.T) {
14 const input = `
15,,
16"","",""
17"""","""",""""
18field1,"field"2,field"3" my friend
19field4,"field"5 with "multiple" quotes "to" escape,field6
20""",""",""" has a couple "" embedded quotes and a , comma",""" """
21x,"hello,
22"" world , " foo,y
23field1,field2,"test eof with quotes"`
24 const expected = `
25,,
26"","",""
27"""","""",""""
28field1,"field2","field3 my friend"
29field4,"field5 with multiple quotes to escape",field6
30""",""",""" has a couple "" embedded quotes and a , comma",""" """
31x,"hello,
32"" world , foo",y
33field1,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}

Callers

nothing calls this directly

Calls 5

newPreprocessFunction · 0.85
StringMethod · 0.65
NewReaderMethod · 0.45
CopyMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected