(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestTree(t *testing.T) { |
| 11 | hStub := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) |
| 12 | hIndex := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) |
| 13 | hFavicon := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) |
| 14 | hArticleList := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) |
| 15 | hArticleNear := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) |
| 16 | hArticleShow := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) |
| 17 | hArticleShowRelated := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) |
| 18 | hArticleShowOpts := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) |
| 19 | hArticleSlug := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) |
| 20 | hArticleByUser := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) |
| 21 | hUserList := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) |
| 22 | hUserShow := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) |
| 23 | hAdminCatchall := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) |
| 24 | hAdminAppShow := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) |
| 25 | hAdminAppShowCatchall := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) |
| 26 | hUserProfile := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) |
| 27 | hUserSuper := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) |
| 28 | hUserAll := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) |
| 29 | hHubView1 := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) |
| 30 | hHubView2 := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) |
| 31 | hHubView3 := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) |
| 32 | |
| 33 | tr := &node{} |
| 34 | |
| 35 | tr.InsertRoute(mGET, "/", hIndex) |
| 36 | tr.InsertRoute(mGET, "/favicon.ico", hFavicon) |
| 37 | |
| 38 | tr.InsertRoute(mGET, "/pages/*", hStub) |
| 39 | |
| 40 | tr.InsertRoute(mGET, "/article", hArticleList) |
| 41 | tr.InsertRoute(mGET, "/article/", hArticleList) |
| 42 | |
| 43 | tr.InsertRoute(mGET, "/article/near", hArticleNear) |
| 44 | tr.InsertRoute(mGET, "/article/{id}", hStub) |
| 45 | tr.InsertRoute(mGET, "/article/{id}", hArticleShow) |
| 46 | tr.InsertRoute(mGET, "/article/{id}", hArticleShow) // duplicate will have no effect |
| 47 | tr.InsertRoute(mGET, "/article/@{user}", hArticleByUser) |
| 48 | |
| 49 | tr.InsertRoute(mGET, "/article/{sup}/{opts}", hArticleShowOpts) |
| 50 | tr.InsertRoute(mGET, "/article/{id}/{opts}", hArticleShowOpts) // overwrite above route, latest wins |
| 51 | |
| 52 | tr.InsertRoute(mGET, "/article/{iffd}/edit", hStub) |
| 53 | tr.InsertRoute(mGET, "/article/{id}//related", hArticleShowRelated) |
| 54 | tr.InsertRoute(mGET, "/article/slug/{month}/-/{day}/{year}", hArticleSlug) |
| 55 | |
| 56 | tr.InsertRoute(mGET, "/admin/user", hUserList) |
| 57 | tr.InsertRoute(mGET, "/admin/user/", hStub) // will get replaced by next route |
| 58 | tr.InsertRoute(mGET, "/admin/user/", hUserList) |
| 59 | |
| 60 | tr.InsertRoute(mGET, "/admin/user//{id}", hUserShow) |
| 61 | tr.InsertRoute(mGET, "/admin/user/{id}", hUserShow) |
| 62 | |
| 63 | tr.InsertRoute(mGET, "/admin/apps/{id}", hAdminAppShow) |
| 64 | tr.InsertRoute(mGET, "/admin/apps/{id}/*", hAdminAppShowCatchall) |
| 65 | |
| 66 | tr.InsertRoute(mGET, "/admin/*", hStub) // catchall segment will get replaced by next route |
| 67 | tr.InsertRoute(mGET, "/admin/*", hAdminCatchall) |
nothing calls this directly
no test coverage detected
searching dependent graphs…