(t *testing.T)
| 239 | } |
| 240 | |
| 241 | func TestDecoderBoolNull(t *testing.T) { |
| 242 | testCases := []struct { |
| 243 | name string |
| 244 | json string |
| 245 | expectedResult bool |
| 246 | expectations func(t *testing.T, v *bool, err error) |
| 247 | }{ |
| 248 | { |
| 249 | name: "true-basic", |
| 250 | json: "true", |
| 251 | expectations: func(t *testing.T, v *bool, err error) { |
| 252 | assert.Nil(t, err, "err should be nil") |
| 253 | assert.True(t, *v, "result should be true") |
| 254 | }, |
| 255 | }, |
| 256 | { |
| 257 | name: "false-basic", |
| 258 | json: "false", |
| 259 | expectations: func(t *testing.T, v *bool, err error) { |
| 260 | assert.Nil(t, err, "err should be nil") |
| 261 | assert.False(t, *v, "result should be false") |
| 262 | }, |
| 263 | }, |
| 264 | { |
| 265 | name: "null-basic", |
| 266 | json: "null", |
| 267 | expectations: func(t *testing.T, v *bool, err error) { |
| 268 | assert.Nil(t, err, "err should be nil") |
| 269 | assert.Nil(t, v, "result should be nil") |
| 270 | }, |
| 271 | }, |
| 272 | { |
| 273 | name: "true-error", |
| 274 | json: "taue", |
| 275 | expectations: func(t *testing.T, v *bool, err error) { |
| 276 | assert.NotNil(t, err, "err should be nil") |
| 277 | assert.IsType(t, InvalidJSONError(""), err, "err should be of type InvalidJSONError") |
| 278 | assert.Nil(t, v, "result should be false") |
| 279 | }, |
| 280 | }, |
| 281 | { |
| 282 | name: "true-error2", |
| 283 | json: "trae", |
| 284 | expectations: func(t *testing.T, v *bool, err error) { |
| 285 | assert.NotNil(t, err, "err should be nil") |
| 286 | assert.IsType(t, InvalidJSONError(""), err, "err should be of type InvalidJSONError") |
| 287 | assert.Nil(t, v, "result should be nil") |
| 288 | }, |
| 289 | }, |
| 290 | { |
| 291 | name: "true-error3", |
| 292 | json: "trua", |
| 293 | expectations: func(t *testing.T, v *bool, err error) { |
| 294 | assert.NotNil(t, err, "err should be nil") |
| 295 | assert.IsType(t, InvalidJSONError(""), err, "err should be of type InvalidJSONError") |
| 296 | assert.Nil(t, v, "result should be nil") |
| 297 | }, |
| 298 | }, |
nothing calls this directly
no test coverage detected
searching dependent graphs…