MCPcopy
hub / github.com/mitchellh/mapstructure / TestDecode_EmbeddedPointer

Function TestDecode_EmbeddedPointer

mapstructure_test.go:500–526  ·  mapstructure_test.go::TestDecode_EmbeddedPointer
(t *testing.T)

Source from the content-addressed store, hash-verified

498}
499
500func 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
528func TestDecode_EmbeddedSlice(t *testing.T) {
529 t.Parallel()

Callers

nothing calls this directly

Calls 1

DecodeFunction · 0.85

Tested by

no test coverage detected