(t *testing.T)
| 243 | } |
| 244 | |
| 245 | func TestMuxPlain(t *testing.T) { |
| 246 | r := NewRouter() |
| 247 | r.Get("/hi", func(w http.ResponseWriter, r *http.Request) { |
| 248 | w.Write([]byte("bye")) |
| 249 | }) |
| 250 | r.NotFound(func(w http.ResponseWriter, r *http.Request) { |
| 251 | w.WriteHeader(404) |
| 252 | w.Write([]byte("nothing here")) |
| 253 | }) |
| 254 | |
| 255 | ts := httptest.NewServer(r) |
| 256 | defer ts.Close() |
| 257 | |
| 258 | if _, body := testRequest(t, ts, "GET", "/hi", nil); body != "bye" { |
| 259 | t.Fatal(body) |
| 260 | } |
| 261 | if _, body := testRequest(t, ts, "GET", "/nothing-here", nil); body != "nothing here" { |
| 262 | t.Fatal(body) |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | func TestMuxEmptyRoutes(t *testing.T) { |
| 267 | mux := NewRouter() |
nothing calls this directly
no test coverage detected