(t *testing.T)
| 713 | } |
| 714 | |
| 715 | func 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 | } |
nothing calls this directly
no test coverage detected