MCPcopy Create free account
hub / github.com/devfile/api / TestDecodeAttributes

Function TestDecodeAttributes

pkg/attributes/attributes_test.go:715–750  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

713}
714
715func TestDecodeAttributes(t *testing.T) {
716 for _, test := range decodeAttributesTestCases {
717 t.Run(test.name, func(t *testing.T) {
718 var err error
719
720 if test.expectedBooleans != nil {
721 err = nil
722 assert.Equal(t, test.expectedBooleans, test.attributes.Booleans(&err))
723 checkError(t, err, test.expectedBooleansError)
724 }
725 if test.expectedStrings != nil {
726 err = nil
727 assert.Equal(t, test.expectedStrings, test.attributes.Strings(&err))
728 checkError(t, err, test.expectedStringsError)
729 }
730 if test.expectedNumbers != nil {
731 err = nil
732 assert.Equal(t, test.expectedNumbers, test.attributes.Numbers(&err))
733 checkError(t, err, test.expectedNumbersError)
734 }
735
736 err = nil
737 assert.Equal(t, test.expectedInterface, test.attributes.AsInterface(&err))
738 checkError(t, err, test.expectedInterfaceError)
739
740 err = test.attributes.Into(test.decodeInto)
741 checkError(t, err, test.decodeIntoError)
742
743 decodedValue := reflect.ValueOf(test.decodeInto)
744 if decodedValue.Kind() == reflect.Ptr {
745 decodedValue = decodedValue.Elem()
746 }
747 assert.Equal(t, test.decodeIntoExpectedValue, decodedValue.Interface())
748 })
749 }
750}

Callers

nothing calls this directly

Calls 6

checkErrorFunction · 0.85
BooleansMethod · 0.80
StringsMethod · 0.80
NumbersMethod · 0.80
AsInterfaceMethod · 0.80
IntoMethod · 0.80

Tested by

no test coverage detected