MCPcopy
hub / github.com/segmentio/kafka-go / TestReadStringArray

Function TestReadStringArray

read_test.go:58–83  ·  read_test.go::TestReadStringArray
(t *testing.T)

Source from the content-addressed store, hash-verified

56}
57
58func TestReadStringArray(t *testing.T) {
59 testCases := map[string]struct {
60 Value []string
61 }{
62 "nil": {
63 Value: nil,
64 },
65 "multiple elements": {
66 Value: []string{"a", "b", "c"},
67 },
68 }
69
70 for label, test := range testCases {
71 t.Run(label, func(t *testing.T) {
72 b := bytes.NewBuffer(nil)
73 w := &writeBuffer{w: b}
74 w.writeStringArray(test.Value)
75
76 var actual []string
77 readStringArray(bufio.NewReader(b), b.Len(), &actual)
78 if !reflect.DeepEqual(test.Value, actual) {
79 t.Errorf("expected %v; got %v", test.Value, actual)
80 }
81 })
82 }
83}
84
85func TestReadMapStringInt32(t *testing.T) {
86 testCases := map[string]struct {

Callers

nothing calls this directly

Calls 4

writeStringArrayMethod · 0.95
readStringArrayFunction · 0.85
NewReaderMethod · 0.65
LenMethod · 0.65

Tested by

no test coverage detected