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

Function TestDecode_Embedded

mapstructure_test.go:474–498  ·  mapstructure_test.go::TestDecode_Embedded
(t *testing.T)

Source from the content-addressed store, hash-verified

472}
473
474func TestDecode_Embedded(t *testing.T) {
475 t.Parallel()
476
477 input := map[string]interface{}{
478 "vstring": "foo",
479 "Basic": map[string]interface{}{
480 "vstring": "innerfoo",
481 },
482 "vunique": "bar",
483 }
484
485 var result Embedded
486 err := Decode(input, &result)
487 if err != nil {
488 t.Fatalf("got an err: %s", err.Error())
489 }
490
491 if result.Vstring != "innerfoo" {
492 t.Errorf("vstring value should be 'innerfoo': %#v", result.Vstring)
493 }
494
495 if result.Vunique != "bar" {
496 t.Errorf("vunique value should be 'bar': %#v", result.Vunique)
497 }
498}
499
500func TestDecode_EmbeddedPointer(t *testing.T) {
501 t.Parallel()

Callers

nothing calls this directly

Calls 2

DecodeFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected