MCPcopy Create free account
hub / github.com/BryanMwangi/pine / TestRouter_SingleParam

Function TestRouter_SingleParam

router_test.go:60–71  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

58}
59
60func TestRouter_SingleParam(t *testing.T) {
61 r := newTestRouter()
62 r.Insert("GET", "/user/:id", []Handler{func(c *Ctx) error { return nil }})
63
64 _, params, found := r.Search("GET", "/user/42")
65 if !found {
66 t.Fatal("expected match")
67 }
68 if params["id"] != "42" {
69 t.Errorf("expected id=42, got %q", params["id"])
70 }
71}
72
73func TestRouter_MultipleParams(t *testing.T) {
74 r := newTestRouter()

Callers

nothing calls this directly

Calls 3

newTestRouterFunction · 0.85
InsertMethod · 0.80
SearchMethod · 0.80

Tested by

no test coverage detected