Home / Function/ TestTreeInvalidNodeType() — gin Function Reference

TestTreeInvalidNodeType() — gin Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  a42ef20d_536f_a8b4_1c7c_ac5d96cb76ae["TestTreeInvalidNodeType()"]
  95642d64_cc2a_14f0_a93c_52464b2a60b9["tree_test.go"]
  a42ef20d_536f_a8b4_1c7c_ac5d96cb76ae -->|defined in| 95642d64_cc2a_14f0_a93c_52464b2a60b9
  93c1c821_291f_3e71_2ae0_563c40ff3ee5["fakeHandler()"]
  a42ef20d_536f_a8b4_1c7c_ac5d96cb76ae -->|calls| 93c1c821_291f_3e71_2ae0_563c40ff3ee5
  e88fa484_0d98_1d59_f804_c3948a6745fe["catchPanic()"]
  a42ef20d_536f_a8b4_1c7c_ac5d96cb76ae -->|calls| e88fa484_0d98_1d59_f804_c3948a6745fe
  e7a2b9cb_792d_4373_e0f6_32e424a8c5db["getSkippedNodes()"]
  a42ef20d_536f_a8b4_1c7c_ac5d96cb76ae -->|calls| e7a2b9cb_792d_4373_e0f6_32e424a8c5db
  style a42ef20d_536f_a8b4_1c7c_ac5d96cb76ae fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tree_test.go lines 874–899

func TestTreeInvalidNodeType(t *testing.T) {
	const panicMsg = "invalid node type"

	tree := &node{}
	tree.addRoute("/", fakeHandler("/"))
	tree.addRoute("/:page", fakeHandler("/:page"))

	// set invalid node type
	tree.children[0].nType = 42

	// normal lookup
	recv := catchPanic(func() {
		tree.getValue("/test", nil, getSkippedNodes(), false)
	})
	if rs, ok := recv.(string); !ok || rs != panicMsg {
		t.Fatalf("Expected panic '"+panicMsg+"', got '%v'", recv)
	}

	// case-insensitive lookup
	recv = catchPanic(func() {
		tree.findCaseInsensitivePath("/test", true)
	})
	if rs, ok := recv.(string); !ok || rs != panicMsg {
		t.Fatalf("Expected panic '"+panicMsg+"', got '%v'", recv)
	}
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does TestTreeInvalidNodeType() do?
TestTreeInvalidNodeType() is a function in the gin codebase, defined in tree_test.go.
Where is TestTreeInvalidNodeType() defined?
TestTreeInvalidNodeType() is defined in tree_test.go at line 874.
What does TestTreeInvalidNodeType() call?
TestTreeInvalidNodeType() calls 3 function(s): catchPanic, fakeHandler, getSkippedNodes.

Analyze Your Own Codebase

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

Try Supermodel Free