--------------------------------------------------------------------------- Method isolation ---------------------------------------------------------------------------
(t *testing.T)
| 136 | // --------------------------------------------------------------------------- |
| 137 | |
| 138 | func TestRouter_MethodIsolation(t *testing.T) { |
| 139 | r := newTestRouter() |
| 140 | insertRoute(r, "GET", "/res") |
| 141 | insertRoute(r, "POST", "/res") |
| 142 | insertRoute(r, "DELETE", "/res") |
| 143 | |
| 144 | for _, method := range []string{"GET", "POST", "DELETE"} { |
| 145 | _, _, found := r.Search(method, "/res") |
| 146 | if !found { |
| 147 | t.Errorf("expected to find %s /res", method) |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | // Wrong method — path exists but wrong method → not found at router level. |
| 152 | _, _, found := r.Search("PUT", "/res") |
| 153 | if found { |
| 154 | t.Error("PUT /res should not be found (not registered)") |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | func TestRouter_SearchAnyMethod(t *testing.T) { |
| 159 | r := newTestRouter() |
nothing calls this directly
no test coverage detected