Test for issue #46.
(t *testing.T)
| 356 | |
| 357 | // Test for issue #46. |
| 358 | func TestBasic_Struct(t *testing.T) { |
| 359 | t.Parallel() |
| 360 | |
| 361 | input := map[string]interface{}{ |
| 362 | "vdata": map[string]interface{}{ |
| 363 | "vstring": "foo", |
| 364 | }, |
| 365 | } |
| 366 | |
| 367 | var result, inner Basic |
| 368 | result.Vdata = &inner |
| 369 | err := Decode(input, &result) |
| 370 | if err != nil { |
| 371 | t.Fatalf("got an err: %s", err) |
| 372 | } |
| 373 | expected := Basic{ |
| 374 | Vdata: &Basic{ |
| 375 | Vstring: "foo", |
| 376 | }, |
| 377 | } |
| 378 | if !reflect.DeepEqual(result, expected) { |
| 379 | t.Fatalf("bad: %#v", result) |
| 380 | } |
| 381 | } |
| 382 | |
| 383 | func TestBasic_interfaceStruct(t *testing.T) { |
| 384 | t.Parallel() |