diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-01-30 08:30:02 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-30 08:30:02 -0500 |
commit | c01d9ad6cf3f8bb2ad4145441816598d8ffa2d9e (patch) | |
tree | f995a08e296b5088df2a882ab70251c7b2b8cfe7 /vendor/github.com/gorilla/mux/mux_test.go | |
parent | 3e2f879b77b9b9d089bc8f83304b8b21b83c5bd9 (diff) | |
download | chat-c01d9ad6cf3f8bb2ad4145441816598d8ffa2d9e.tar.gz chat-c01d9ad6cf3f8bb2ad4145441816598d8ffa2d9e.tar.bz2 chat-c01d9ad6cf3f8bb2ad4145441816598d8ffa2d9e.zip |
Implement APIv4 infrastructure (#5191)
* Implement APIv4 infrastructure
* Update parameter requirement functions per feedback
Diffstat (limited to 'vendor/github.com/gorilla/mux/mux_test.go')
-rw-r--r-- | vendor/github.com/gorilla/mux/mux_test.go | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/vendor/github.com/gorilla/mux/mux_test.go b/vendor/github.com/gorilla/mux/mux_test.go index 39a099c1e..b4b049efc 100644 --- a/vendor/github.com/gorilla/mux/mux_test.go +++ b/vendor/github.com/gorilla/mux/mux_test.go @@ -1017,6 +1017,9 @@ func TestBuildVarsFunc(t *testing.T) { func TestSubRouter(t *testing.T) { subrouter1 := new(Route).Host("{v1:[a-z]+}.google.com").Subrouter() subrouter2 := new(Route).PathPrefix("/foo/{v1}").Subrouter() + subrouter3 := new(Route).PathPrefix("/foo").Subrouter() + subrouter4 := new(Route).PathPrefix("/foo/bar").Subrouter() + subrouter5 := new(Route).PathPrefix("/{category}").Subrouter() tests := []routeTest{ { @@ -1057,6 +1060,61 @@ func TestSubRouter(t *testing.T) { pathTemplate: `/foo/{v1}/baz/{v2}`, shouldMatch: false, }, + { + route: subrouter3.Path("/"), + request: newRequest("GET", "http://localhost/foo/"), + vars: map[string]string{}, + host: "", + path: "/foo/", + pathTemplate: `/foo/`, + shouldMatch: true, + }, + { + route: subrouter3.Path(""), + request: newRequest("GET", "http://localhost/foo"), + vars: map[string]string{}, + host: "", + path: "/foo", + pathTemplate: `/foo`, + shouldMatch: true, + }, + + { + route: subrouter4.Path("/"), + request: newRequest("GET", "http://localhost/foo/bar/"), + vars: map[string]string{}, + host: "", + path: "/foo/bar/", + pathTemplate: `/foo/bar/`, + shouldMatch: true, + }, + { + route: subrouter4.Path(""), + request: newRequest("GET", "http://localhost/foo/bar"), + vars: map[string]string{}, + host: "", + path: "/foo/bar", + pathTemplate: `/foo/bar`, + shouldMatch: true, + }, + { + route: subrouter5.Path("/"), + request: newRequest("GET", "http://localhost/baz/"), + vars: map[string]string{"category": "baz"}, + host: "", + path: "/baz/", + pathTemplate: `/{category}/`, + shouldMatch: true, + }, + { + route: subrouter5.Path(""), + request: newRequest("GET", "http://localhost/baz"), + vars: map[string]string{"category": "baz"}, + host: "", + path: "/baz", + pathTemplate: `/{category}`, + shouldMatch: true, + }, } for _, test := range tests { |