|
9 | 9 | "fmt"
|
10 | 10 | "io"
|
11 | 11 | "io/ioutil" //nolint: staticcheck
|
| 12 | + "reflect" |
12 | 13 | "strings"
|
13 | 14 | "testing"
|
14 | 15 | "time"
|
@@ -309,6 +310,33 @@ func TestInvokes(t *testing.T) {
|
309 | 310 | },
|
310 | 311 | options: []Option{WithSetIndent(">>", " ")},
|
311 | 312 | },
|
| 313 | + { |
| 314 | + name: "WithUseNumber(true) results in json.Number instead of float64 when decoding to an interface{}", |
| 315 | + input: `19.99`, |
| 316 | + expected: expected{`"Number"`, nil}, |
| 317 | + handler: func(event interface{}) (string, error) { |
| 318 | + return reflect.TypeOf(event).Name(), nil |
| 319 | + }, |
| 320 | + options: []Option{WithUseNumber(true)}, |
| 321 | + }, |
| 322 | + { |
| 323 | + name: "WithUseNumber(false)", |
| 324 | + input: `19.99`, |
| 325 | + expected: expected{`"float64"`, nil}, |
| 326 | + handler: func(event interface{}) (string, error) { |
| 327 | + return reflect.TypeOf(event).Name(), nil |
| 328 | + }, |
| 329 | + options: []Option{WithUseNumber(false)}, |
| 330 | + }, |
| 331 | + { |
| 332 | + name: "No decoder options provided is the same as WithUseNumber(false)", |
| 333 | + input: `19.99`, |
| 334 | + expected: expected{`"float64"`, nil}, |
| 335 | + handler: func(event interface{}) (string, error) { |
| 336 | + return reflect.TypeOf(event).Name(), nil |
| 337 | + }, |
| 338 | + options: []Option{}, |
| 339 | + }, |
312 | 340 | {
|
313 | 341 | name: "bytes are base64 encoded strings",
|
314 | 342 | input: `"aGVsbG8="`,
|
|
0 commit comments