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

Function TestBasic_interfaceStructNonPtr

mapstructure_test.go:405–424  ·  mapstructure_test.go::TestBasic_interfaceStructNonPtr

Issue 187

(t *testing.T)

Source from the content-addressed store, hash-verified

403
404// Issue 187
405func TestBasic_interfaceStructNonPtr(t *testing.T) {
406 t.Parallel()
407
408 input := map[string]interface{}{
409 "vstring": "foo",
410 }
411
412 var iface interface{} = Basic{}
413 err := Decode(input, &iface)
414 if err != nil {
415 t.Fatalf("got an err: %s", err)
416 }
417
418 expected := Basic{
419 Vstring: "foo",
420 }
421 if !reflect.DeepEqual(iface, expected) {
422 t.Fatalf("bad: %#v", iface)
423 }
424}
425
426func TestDecode_BasicSquash(t *testing.T) {
427 t.Parallel()

Callers

nothing calls this directly

Calls 1

DecodeFunction · 0.85

Tested by

no test coverage detected