(t *testing.T)
| 334 | } |
| 335 | |
| 336 | func TestDecoderFloat64Null(t *testing.T) { |
| 337 | testCases := []struct { |
| 338 | name string |
| 339 | json string |
| 340 | expectedResult float64 |
| 341 | resultIsNil bool |
| 342 | err bool |
| 343 | errType interface{} |
| 344 | }{ |
| 345 | { |
| 346 | name: "basic-float", |
| 347 | json: "1.1", |
| 348 | expectedResult: 1.1, |
| 349 | }, |
| 350 | { |
| 351 | name: "basic-exponent-positive-positive-exp", |
| 352 | json: " 1e2", |
| 353 | expectedResult: 100, |
| 354 | }, |
| 355 | { |
| 356 | name: "basic-exponent-positive-positive-exp2", |
| 357 | json: "5e+06", |
| 358 | expectedResult: 5000000, |
| 359 | }, |
| 360 | { |
| 361 | name: "basic-exponent-positive-positive-exp3", |
| 362 | json: "3e+3", |
| 363 | expectedResult: 3000, |
| 364 | }, |
| 365 | { |
| 366 | name: "basic-null", |
| 367 | json: "null", |
| 368 | expectedResult: 0, |
| 369 | resultIsNil: true, |
| 370 | }, |
| 371 | { |
| 372 | name: "basic-null-err", |
| 373 | json: "nxll", |
| 374 | expectedResult: 0, |
| 375 | err: true, |
| 376 | errType: InvalidJSONError(""), |
| 377 | resultIsNil: true, |
| 378 | }, |
| 379 | { |
| 380 | name: "basic-negative-err", |
| 381 | json: "-", |
| 382 | expectedResult: 0, |
| 383 | err: true, |
| 384 | errType: InvalidJSONError(""), |
| 385 | resultIsNil: true, |
| 386 | }, |
| 387 | { |
| 388 | name: "basic-negative-err", |
| 389 | json: "-q", |
| 390 | expectedResult: 0, |
| 391 | err: true, |
| 392 | errType: InvalidJSONError(""), |
| 393 | resultIsNil: true, |
nothing calls this directly
no test coverage detected
searching dependent graphs…