Home / Function/ TestWildcardInvalidSlash() — gin Function Reference

TestWildcardInvalidSlash() — gin Function Reference

Architecture documentation for the TestWildcardInvalidSlash() function in tree_test.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  a135d659_a18b_155d_68df_eb68bd477e25["TestWildcardInvalidSlash()"]
  95642d64_cc2a_14f0_a93c_52464b2a60b9["tree_test.go"]
  a135d659_a18b_155d_68df_eb68bd477e25 -->|defined in| 95642d64_cc2a_14f0_a93c_52464b2a60b9
  e88fa484_0d98_1d59_f804_c3948a6745fe["catchPanic()"]
  a135d659_a18b_155d_68df_eb68bd477e25 -->|calls| e88fa484_0d98_1d59_f804_c3948a6745fe
  style a135d659_a18b_155d_68df_eb68bd477e25 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tree_test.go lines 997–1020

func TestWildcardInvalidSlash(t *testing.T) {
	const panicMsgPrefix = "no / before catch-all in path"

	routes := map[string]bool{
		"/foo/bar":  true,
		"/foo/x*zy": false,
		"/foo/b*r":  false,
	}

	for route, valid := range routes {
		tree := &node{}
		recv := catchPanic(func() {
			tree.addRoute(route, nil)
		})

		if recv == nil != valid {
			t.Fatalf("%s should be %t but got %v", route, valid, recv)
		}

		if rs, ok := recv.(string); recv != nil && (!ok || !strings.HasPrefix(rs, panicMsgPrefix)) {
			t.Fatalf(`"Expected panic "%s" for route '%s', got "%v"`, panicMsgPrefix, route, recv)
		}
	}
}

Domain

Subdomains

Defined In

Calls

Frequently Asked Questions

What does TestWildcardInvalidSlash() do?
TestWildcardInvalidSlash() is a function in the gin codebase, defined in tree_test.go.
Where is TestWildcardInvalidSlash() defined?
TestWildcardInvalidSlash() is defined in tree_test.go at line 997.
What does TestWildcardInvalidSlash() call?
TestWildcardInvalidSlash() calls 1 function(s): catchPanic.

Analyze Your Own Codebase

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

Try Supermodel Free