there may be a issue with one of the tests in mux_test
Open
Nobody has claimed this yet.
routing
- Dominant language
- Go
- Stars
- 22.9k
- Forks
- 1.4k
- Avg merge
- 5h 17m
- Merged PRs (30d)
- 10
Description
1 func TestMuxRegexp2(t *testing.T) {
2 r := NewRouter()
3 r.Get("/foo-{suffix:[a-z]{2,3}}.json", func(w http.ResponseWriter, r *http.Request) {
4 w.Write([]byte(URLParam(r, "suffix")))
5 })
6 ts := httptest.NewServer(r)
7 defer ts.Close()
8
9 if _, body := testRequest(t, ts, "GET", "/foo-.json", nil); body != "" {
10 t.Fatalf(body)
11 }
12 if _, body := testRequest(t, ts, "GET", "/foo-abc.json", nil); body != "abc" {
13 t.Fatalf(body)
14 }
15}
I don't think the /foo-.json in line 9 matches the /foo-{suffix:[a-z]{2,3}}.json in line 3.
because "" does not satisfy [a-z]{2,3}.or what is the original purpose of this design.
this question is similar to #609.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with TestMuxRegexp2 in mux_test.go around line 1469 and run that test to observe the /foo-.json and /foo-abc.json cases. Read the related discussion in issue #609 and the router matching behavior; done means the test's expected behavior and its intended regexp semantics are resolved, with the test or issue clarified accordingly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100