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
  6e25d11e_c92e_9fda_f857_4a644138cac4["TestWildcardInvalidSlash()"]
  7d17d111_6d55_8539_e0ed_b32eea9e5ef6["catchPanic()"]
  6e25d11e_c92e_9fda_f857_4a644138cac4 -->|calls| 7d17d111_6d55_8539_e0ed_b32eea9e5ef6
  style 6e25d11e_c92e_9fda_f857_4a644138cac4 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

Calls

Frequently Asked Questions

What does TestWildcardInvalidSlash() do?
TestWildcardInvalidSlash() is a function in the gin codebase.
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