(t *testing.T)
| 56 | } |
| 57 | |
| 58 | func 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 | |
| 85 | func TestReadMapStringInt32(t *testing.T) { |
| 86 | testCases := map[string]struct { |
nothing calls this directly
no test coverage detected