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

Function TestDecode_EmbeddedSquash

mapstructure_test.go:638–659  ·  mapstructure_test.go::TestDecode_EmbeddedSquash
(t *testing.T)

Source from the content-addressed store, hash-verified

636}
637
638func TestDecode_EmbeddedSquash(t *testing.T) {
639 t.Parallel()
640
641 input := map[string]interface{}{
642 "vstring": "foo",
643 "vunique": "bar",
644 }
645
646 var result EmbeddedSquash
647 err := Decode(input, &result)
648 if err != nil {
649 t.Fatalf("got an err: %s", err.Error())
650 }
651
652 if result.Vstring != "foo" {
653 t.Errorf("vstring value should be 'foo': %#v", result.Vstring)
654 }
655
656 if result.Vunique != "bar" {
657 t.Errorf("vunique value should be 'bar': %#v", result.Vunique)
658 }
659}
660
661func TestDecodeFrom_EmbeddedSquash(t *testing.T) {
662 t.Parallel()

Callers

nothing calls this directly

Calls 2

DecodeFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected