MCPcopy
hub / github.com/gin-gonic/gin / TestUriBinding

Function TestUriBinding

binding/binding_test.go:815–834  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

813}
814
815func TestUriBinding(t *testing.T) {
816 b := Uri
817 assert.Equal(t, "uri", b.Name())
818
819 type Tag struct {
820 Name string `uri:"name"`
821 }
822 var tag Tag
823 m := make(map[string][]string)
824 m["name"] = []string{"thinkerou"}
825 require.NoError(t, b.BindUri(m, &tag))
826 assert.Equal(t, "thinkerou", tag.Name)
827
828 type NotSupportStruct struct {
829 Name map[string]any `uri:"name"`
830 }
831 var not NotSupportStruct
832 require.Error(t, b.BindUri(m, &not))
833 assert.Equal(t, map[string]any(nil), not.Name)
834}
835
836func TestUriInnerBinding(t *testing.T) {
837 type Tag struct {

Callers

nothing calls this directly

Calls 3

NameMethod · 0.65
BindUriMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…