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

Function TestBindUriError

githubapi_test.go:334–349  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

332}
333
334func TestBindUriError(t *testing.T) {
335 DefaultWriter = os.Stdout
336 router := New()
337
338 type Member struct {
339 Number string `uri:"num" binding:"required,uuid"`
340 }
341 router.Handle(http.MethodGet, "/new/rest/:num", func(c *Context) {
342 var m Member
343 require.Error(t, c.BindUri(&m))
344 })
345
346 path1, _ := exampleFromPath("/new/rest/:num")
347 w1 := PerformRequest(router, http.MethodGet, path1)
348 assert.Equal(t, http.StatusBadRequest, w1.Code)
349}
350
351func TestRaceContextCopy(t *testing.T) {
352 DefaultWriter = os.Stdout

Callers

nothing calls this directly

Calls 6

NewFunction · 0.85
exampleFromPathFunction · 0.85
PerformRequestFunction · 0.85
HandleMethod · 0.65
BindUriMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected