(t *testing.T)
| 223 | } |
| 224 | |
| 225 | func TestEncoderStringNullKeyEmpty(t *testing.T) { |
| 226 | var testCases = []struct { |
| 227 | name string |
| 228 | baseJSON string |
| 229 | expectedJSON string |
| 230 | }{ |
| 231 | { |
| 232 | name: "basic 1st elem", |
| 233 | baseJSON: "{", |
| 234 | expectedJSON: `{"foo":null,"bar":"true"`, |
| 235 | }, |
| 236 | { |
| 237 | name: "basic 2nd elem", |
| 238 | baseJSON: `{"test":"test"`, |
| 239 | expectedJSON: `{"test":"test","foo":null,"bar":"true"`, |
| 240 | }, |
| 241 | } |
| 242 | for _, testCase := range testCases { |
| 243 | t.Run("true", func(t *testing.T) { |
| 244 | var b strings.Builder |
| 245 | var enc = NewEncoder(&b) |
| 246 | enc.writeString(testCase.baseJSON) |
| 247 | enc.StringKeyNullEmpty("foo", "") |
| 248 | enc.AddStringKeyNullEmpty("bar", "true") |
| 249 | enc.Write() |
| 250 | assert.Equal(t, testCase.expectedJSON, b.String()) |
| 251 | }) |
| 252 | } |
| 253 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…