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

Function TestDecode_EmbeddedArray

mapstructure_test.go:551–572  ·  mapstructure_test.go::TestDecode_EmbeddedArray
(t *testing.T)

Source from the content-addressed store, hash-verified

549}
550
551func TestDecode_EmbeddedArray(t *testing.T) {
552 t.Parallel()
553
554 input := map[string]interface{}{
555 "array_alias": [2]string{"foo", "bar"},
556 "vunique": "bar",
557 }
558
559 var result EmbeddedArray
560 err := Decode(input, &result)
561 if err != nil {
562 t.Fatalf("got an err: %s", err.Error())
563 }
564
565 if !reflect.DeepEqual(result.ArrayAlias, ArrayAlias([2]string{"foo", "bar"})) {
566 t.Errorf("array value: %#v", result.ArrayAlias)
567 }
568
569 if result.Vunique != "bar" {
570 t.Errorf("vunique value should be 'bar': %#v", result.Vunique)
571 }
572}
573
574func TestDecode_decodeSliceWithArray(t *testing.T) {
575 t.Parallel()

Callers

nothing calls this directly

Calls 3

DecodeFunction · 0.85
ArrayAliasTypeAlias · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected