| 498 | } |
| 499 | |
| 500 | func TestDecode_EmbeddedPointer(t *testing.T) { |
| 501 | t.Parallel() |
| 502 | |
| 503 | input := map[string]interface{}{ |
| 504 | "vstring": "foo", |
| 505 | "Basic": map[string]interface{}{ |
| 506 | "vstring": "innerfoo", |
| 507 | }, |
| 508 | "vunique": "bar", |
| 509 | } |
| 510 | |
| 511 | var result EmbeddedPointer |
| 512 | err := Decode(input, &result) |
| 513 | if err != nil { |
| 514 | t.Fatalf("err: %s", err) |
| 515 | } |
| 516 | |
| 517 | expected := EmbeddedPointer{ |
| 518 | Basic: &Basic{ |
| 519 | Vstring: "innerfoo", |
| 520 | }, |
| 521 | Vunique: "bar", |
| 522 | } |
| 523 | if !reflect.DeepEqual(result, expected) { |
| 524 | t.Fatalf("bad: %#v", result) |
| 525 | } |
| 526 | } |
| 527 | |
| 528 | func TestDecode_EmbeddedSlice(t *testing.T) { |
| 529 | t.Parallel() |