Home / Function/ TestCreateTestContextWithRouteParams() — gin Function Reference

TestCreateTestContextWithRouteParams() — gin Function Reference

Architecture documentation for the TestCreateTestContextWithRouteParams() function in context_test.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  5fb0d2a3_005b_9bdd_33d6_f22269ec72c4["TestCreateTestContextWithRouteParams()"]
  ebe0ae48_a62b_a38f_5bac_5bbbd96fc508["context_test.go"]
  5fb0d2a3_005b_9bdd_33d6_f22269ec72c4 -->|defined in| ebe0ae48_a62b_a38f_5bac_5bbbd96fc508
  style 5fb0d2a3_005b_9bdd_33d6_f22269ec72c4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

context_test.go lines 3317–3329

func TestCreateTestContextWithRouteParams(t *testing.T) {
	w := httptest.NewRecorder()
	engine := New()
	engine.GET("/:action/:name", func(ctx *Context) {
		ctx.String(http.StatusOK, "%s %s", ctx.Param("action"), ctx.Param("name"))
	})
	c := CreateTestContextOnly(w, engine)
	c.Request, _ = http.NewRequest(http.MethodGet, "/hello/gin", nil)
	engine.HandleContext(c)

	assert.Equal(t, http.StatusOK, w.Code)
	assert.Equal(t, "hello gin", w.Body.String())
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does TestCreateTestContextWithRouteParams() do?
TestCreateTestContextWithRouteParams() is a function in the gin codebase, defined in context_test.go.
Where is TestCreateTestContextWithRouteParams() defined?
TestCreateTestContextWithRouteParams() is defined in context_test.go at line 3317.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free