(t *testing.T)
| 1578 | } |
| 1579 | |
| 1580 | func TestMuxRegexp(t *testing.T) { |
| 1581 | r := NewRouter() |
| 1582 | r.Route("/{param:[0-9]*}/test", func(r Router) { |
| 1583 | r.Get("/", func(w http.ResponseWriter, r *http.Request) { |
| 1584 | w.Write([]byte(fmt.Sprintf("Hi: %s", URLParam(r, "param")))) |
| 1585 | }) |
| 1586 | }) |
| 1587 | |
| 1588 | ts := httptest.NewServer(r) |
| 1589 | defer ts.Close() |
| 1590 | |
| 1591 | if _, body := testRequest(t, ts, "GET", "//test", nil); body != "Hi: " { |
| 1592 | t.Fatal(body) |
| 1593 | } |
| 1594 | } |
| 1595 | |
| 1596 | func TestMuxRegexp2(t *testing.T) { |
| 1597 | r := NewRouter() |