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

Function TestBasic_interfaceStruct

mapstructure_test.go:383–402  ·  mapstructure_test.go::TestBasic_interfaceStruct
(t *testing.T)

Source from the content-addressed store, hash-verified

381}
382
383func TestBasic_interfaceStruct(t *testing.T) {
384 t.Parallel()
385
386 input := map[string]interface{}{
387 "vstring": "foo",
388 }
389
390 var iface interface{} = &Basic{}
391 err := Decode(input, &iface)
392 if err != nil {
393 t.Fatalf("got an err: %s", err)
394 }
395
396 expected := &Basic{
397 Vstring: "foo",
398 }
399 if !reflect.DeepEqual(iface, expected) {
400 t.Fatalf("bad: %#v", iface)
401 }
402}
403
404// Issue 187
405func TestBasic_interfaceStructNonPtr(t *testing.T) {

Callers

nothing calls this directly

Calls 1

DecodeFunction · 0.85

Tested by

no test coverage detected