(t *testing.T)
| 640 | } |
| 641 | |
| 642 | func TestBindSetWithProperType(t *testing.T) { |
| 643 | ts := new(bindTestStruct) |
| 644 | typ := reflect.TypeFor[bindTestStruct]() |
| 645 | val := reflect.ValueOf(ts).Elem() |
| 646 | for i := 0; i < typ.NumField(); i++ { |
| 647 | typeField := typ.Field(i) |
| 648 | structField := val.Field(i) |
| 649 | if !structField.CanSet() { |
| 650 | continue |
| 651 | } |
| 652 | if len(values[typeField.Name]) == 0 { |
| 653 | continue |
| 654 | } |
| 655 | val := values[typeField.Name][0] |
| 656 | err := setWithProperType(typeField.Type.Kind(), val, structField) |
| 657 | assert.NoError(t, err) |
| 658 | } |
| 659 | assertBindTestStruct(t, ts) |
| 660 | |
| 661 | type foo struct { |
| 662 | Bar bytes.Buffer |
| 663 | } |
| 664 | v := &foo{} |
| 665 | typ = reflect.TypeFor[foo]() |
| 666 | val = reflect.ValueOf(v).Elem() |
| 667 | assert.Error(t, setWithProperType(typ.Field(0).Type.Kind(), "5", val.Field(0))) |
| 668 | } |
| 669 | |
| 670 | func BenchmarkBindbindDataWithTags(b *testing.B) { |
| 671 | b.ReportAllocs() |
nothing calls this directly
no test coverage detected
searching dependent graphs…