MCPcopy
hub / github.com/gin-gonic/gin / TestTreeExpandParamsCapacity

Function TestTreeExpandParamsCapacity

tree_test.go:914–940  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

912}
913
914func TestTreeExpandParamsCapacity(t *testing.T) {
915 data := []struct {
916 path string
917 }{
918 {"/:path"},
919 {"/*path"},
920 }
921
922 for _, item := range data {
923 tree := &node{}
924 tree.addRoute(item.path, fakeHandler(item.path))
925 params := make(Params, 0)
926
927 value := tree.getValue("/test", &params, getSkippedNodes(), false)
928
929 if value.params == nil {
930 t.Errorf("Expected %s params to be set, but they weren't", item.path)
931 continue
932 }
933
934 if len(*value.params) != 1 {
935 t.Errorf("Wrong number of %s params: got %d, want %d",
936 item.path, len(*value.params), 1)
937 continue
938 }
939 }
940}
941
942func TestTreeWildcardConflictEx(t *testing.T) {
943 conflicts := [...]struct {

Callers

nothing calls this directly

Calls 4

addRouteMethod · 0.95
getValueMethod · 0.95
fakeHandlerFunction · 0.85
getSkippedNodesFunction · 0.85

Tested by

no test coverage detected