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

Function TestBasic_Struct

mapstructure_test.go:358–381  ·  mapstructure_test.go::TestBasic_Struct

Test for issue #46.

(t *testing.T)

Source from the content-addressed store, hash-verified

356
357// Test for issue #46.
358func TestBasic_Struct(t *testing.T) {
359 t.Parallel()
360
361 input := map[string]interface{}{
362 "vdata": map[string]interface{}{
363 "vstring": "foo",
364 },
365 }
366
367 var result, inner Basic
368 result.Vdata = &inner
369 err := Decode(input, &result)
370 if err != nil {
371 t.Fatalf("got an err: %s", err)
372 }
373 expected := Basic{
374 Vdata: &Basic{
375 Vstring: "foo",
376 },
377 }
378 if !reflect.DeepEqual(result, expected) {
379 t.Fatalf("bad: %#v", result)
380 }
381}
382
383func TestBasic_interfaceStruct(t *testing.T) {
384 t.Parallel()

Callers

nothing calls this directly

Calls 1

DecodeFunction · 0.85

Tested by

no test coverage detected