Home / Function/ TestRaceParamsContextCopy() — gin Function Reference

TestRaceParamsContextCopy() — gin Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

context_test.go lines 3055–3074

func TestRaceParamsContextCopy(t *testing.T) {
	DefaultWriter = os.Stdout
	router := Default()
	nameGroup := router.Group("/:name")
	var wg sync.WaitGroup
	wg.Add(2)
	{
		nameGroup.GET("/api", func(c *Context) {
			go func(c *Context, param string) {
				defer wg.Done()
				// First assert must be executed after the second request
				time.Sleep(50 * time.Millisecond)
				assert.Equal(t, c.Param("name"), param)
			}(c.Copy(), c.Param("name"))
		})
	}
	PerformRequest(router, http.MethodGet, "/name1/api")
	PerformRequest(router, http.MethodGet, "/name2/api")
	wg.Wait()
}

Domain

Subdomains

Defined In

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free