adding tests
This commit is contained in:
29
mux_test.go
29
mux_test.go
@@ -597,6 +597,24 @@ func TestQueries(t *testing.T) {
|
||||
path: "",
|
||||
shouldMatch: true,
|
||||
},
|
||||
{
|
||||
title: "Queries route with empty value and no parameter in request, should not match",
|
||||
route: new(Route).Queries("foo", ""),
|
||||
request: newRequest("GET", "http://localhost"),
|
||||
vars: map[string]string{},
|
||||
host: "",
|
||||
path: "",
|
||||
shouldMatch: false,
|
||||
},
|
||||
{
|
||||
title: "Queries route with empty value and empty parameter in request, should match",
|
||||
route: new(Route).Queries("foo", ""),
|
||||
request: newRequest("GET", "http://localhost?foo="),
|
||||
vars: map[string]string{},
|
||||
host: "",
|
||||
path: "",
|
||||
shouldMatch: true,
|
||||
},
|
||||
{
|
||||
title: "Queries route with overlapping value, should not match",
|
||||
route: new(Route).Queries("foo", "bar"),
|
||||
@@ -607,7 +625,7 @@ func TestQueries(t *testing.T) {
|
||||
shouldMatch: false,
|
||||
},
|
||||
{
|
||||
title: "Queries route with no parameter in request , should not match",
|
||||
title: "Queries route with no parameter in request, should not match",
|
||||
route: new(Route).Queries("foo", "{bar}"),
|
||||
request: newRequest("GET", "http://localhost"),
|
||||
vars: map[string]string{},
|
||||
@@ -615,6 +633,15 @@ func TestQueries(t *testing.T) {
|
||||
path: "",
|
||||
shouldMatch: false,
|
||||
},
|
||||
{
|
||||
title: "Queries route with empty parameter in request, should match",
|
||||
route: new(Route).Queries("foo", "{bar}"),
|
||||
request: newRequest("GET", "http://localhost?foo="),
|
||||
vars: map[string]string{"foo": ""},
|
||||
host: "",
|
||||
path: "",
|
||||
shouldMatch: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
|
||||
Reference in New Issue
Block a user