| 1594 | } |
| 1595 | |
| 1596 | func TestMuxRegexp2(t *testing.T) { |
| 1597 | r := NewRouter() |
| 1598 | r.Get("/foo-{suffix:[a-z]{2,3}}.json", func(w http.ResponseWriter, r *http.Request) { |
| 1599 | w.Write([]byte(URLParam(r, "suffix"))) |
| 1600 | }) |
| 1601 | ts := httptest.NewServer(r) |
| 1602 | defer ts.Close() |
| 1603 | |
| 1604 | if _, body := testRequest(t, ts, "GET", "/foo-.json", nil); body != "" { |
| 1605 | t.Fatal(body) |
| 1606 | } |
| 1607 | if _, body := testRequest(t, ts, "GET", "/foo-abc.json", nil); body != "abc" { |
| 1608 | t.Fatal(body) |
| 1609 | } |
| 1610 | } |
| 1611 | |
| 1612 | func TestMuxRegexp3(t *testing.T) { |
| 1613 | r := NewRouter() |