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

Function TestRouter_Static_ExactMatch

router_test.go:24–38  ·  view source on GitHub ↗

--------------------------------------------------------------------------- Correctness — Insert + Search ---------------------------------------------------------------------------

(t *testing.T)

Source from the content-addressed store, hash-verified

22// ---------------------------------------------------------------------------
23
24func TestRouter_Static_ExactMatch(t *testing.T) {
25 r := newTestRouter()
26 insertRoute(r, "GET", "/hello")
27
28 h, params, found := r.Search("GET", "/hello")
29 if !found {
30 t.Fatal("expected to find /hello")
31 }
32 if len(h) == 0 {
33 t.Fatal("expected handlers to be non-empty")
34 }
35 if len(params) != 0 {
36 t.Errorf("expected no params, got %v", params)
37 }
38}
39
40func TestRouter_Static_NoFalsePositive(t *testing.T) {
41 r := newTestRouter()

Callers

nothing calls this directly

Calls 3

newTestRouterFunction · 0.85
insertRouteFunction · 0.85
SearchMethod · 0.80

Tested by

no test coverage detected