(t *testing.T)
| 164 | } |
| 165 | |
| 166 | func TestEncoderStringNullEmpty(t *testing.T) { |
| 167 | var testCases = []struct { |
| 168 | name string |
| 169 | baseJSON string |
| 170 | expectedJSON string |
| 171 | }{ |
| 172 | { |
| 173 | name: "basic 1st elem", |
| 174 | baseJSON: "[", |
| 175 | expectedJSON: `[null,"true"`, |
| 176 | }, |
| 177 | { |
| 178 | name: "basic 2nd elem", |
| 179 | baseJSON: `["test"`, |
| 180 | expectedJSON: `["test",null,"true"`, |
| 181 | }, |
| 182 | { |
| 183 | name: "basic 2nd elem", |
| 184 | baseJSON: `["test"`, |
| 185 | expectedJSON: `["test",null,"true"`, |
| 186 | }, |
| 187 | } |
| 188 | for _, testCase := range testCases { |
| 189 | t.Run("true", func(t *testing.T) { |
| 190 | var b strings.Builder |
| 191 | var enc = NewEncoder(&b) |
| 192 | enc.writeString(testCase.baseJSON) |
| 193 | enc.StringNullEmpty("") |
| 194 | enc.AddStringNullEmpty("true") |
| 195 | enc.Write() |
| 196 | assert.Equal(t, testCase.expectedJSON, b.String()) |
| 197 | }) |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | func TestEncoderStringNullEmpty2(t *testing.T) { |
| 202 | var testCases = []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…