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

Function TestContextHandlers

context_test.go:300–317  ·  context_test.go::TestContextHandlers
(t *testing.T)

Source from the content-addressed store, hash-verified

298}
299
300func TestContextHandlers(t *testing.T) {
301 c, _ := CreateTestContext(httptest.NewRecorder())
302 assert.Nil(t, c.handlers)
303 assert.Nil(t, c.handlers.Last())
304
305 c.handlers = HandlersChain{}
306 assert.NotNil(t, c.handlers)
307 assert.Nil(t, c.handlers.Last())
308
309 f := func(c *Context) {}
310 g := func(c *Context) {}
311
312 c.handlers = HandlersChain{f}
313 compareFunc(t, f, c.handlers.Last())
314
315 c.handlers = HandlersChain{f, g}
316 compareFunc(t, g, c.handlers.Last())
317}
318
319// TestContextSetGet tests that a parameter is set correctly on the
320// current context and can be retrieved using Get.

Callers

nothing calls this directly

Calls 3

CreateTestContextFunction · 0.85
compareFuncFunction · 0.85
LastMethod · 0.45

Tested by

no test coverage detected