(t *testing.T)
| 1121 | } |
| 1122 | |
| 1123 | func TestEncoderSQLNullStringEmpty(t *testing.T) { |
| 1124 | var testCases = []struct { |
| 1125 | name string |
| 1126 | baseJSON string |
| 1127 | expectedJSON string |
| 1128 | }{ |
| 1129 | { |
| 1130 | name: "basic 1st elem", |
| 1131 | baseJSON: "[", |
| 1132 | expectedJSON: `[null,"bar"`, |
| 1133 | }, |
| 1134 | { |
| 1135 | name: "basic 2nd elem", |
| 1136 | baseJSON: `["test"`, |
| 1137 | expectedJSON: `["test",null,"bar"`, |
| 1138 | }, |
| 1139 | } |
| 1140 | for _, testCase := range testCases { |
| 1141 | t.Run(testCase.name, func(t *testing.T) { |
| 1142 | var b strings.Builder |
| 1143 | var enc = NewEncoder(&b) |
| 1144 | enc.writeString(testCase.baseJSON) |
| 1145 | enc.AddSQLNullStringNullEmpty(&sql.NullString{"", true}) |
| 1146 | enc.SQLNullStringNullEmpty(&sql.NullString{"bar", true}) |
| 1147 | enc.Write() |
| 1148 | assert.Equal(t, testCase.expectedJSON, b.String()) |
| 1149 | }) |
| 1150 | } |
| 1151 | } |
| 1152 | |
| 1153 | func TestEncoderSQLNullStringKeyNullEmpty(t *testing.T) { |
| 1154 | var testCases = []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…