Browse Source

Fix old tests

Remove tests that don't apply anymore
Fix scheme matcher tests
pull/55/head
Raphael Simon 12 years ago
parent
commit
c9469524da
  1. 45
      old_test.go

45
old_test.go

@ -329,35 +329,6 @@ var pathMatcherTests = []pathMatcherTest{ @@ -329,35 +329,6 @@ var pathMatcherTests = []pathMatcherTest{
},
}
type queryMatcherTest struct {
matcher queryMatcher
url string
result bool
}
var queryMatcherTests = []queryMatcherTest{
{
matcher: queryMatcher(map[string]string{"foo": "bar", "baz": "ding"}),
url: "http://localhost:8080/?foo=bar&baz=ding",
result: true,
},
{
matcher: queryMatcher(map[string]string{"foo": "", "baz": ""}),
url: "http://localhost:8080/?foo=anything&baz=anything",
result: true,
},
{
matcher: queryMatcher(map[string]string{"foo": "ding", "baz": "bar"}),
url: "http://localhost:8080/?foo=bar&baz=ding",
result: false,
},
{
matcher: queryMatcher(map[string]string{"bar": "foo", "ding": "baz"}),
url: "http://localhost:8080/?foo=bar&baz=ding",
result: false,
},
}
type schemeMatcherTest struct {
matcher schemeMatcher
url string
@ -519,23 +490,9 @@ func TestPathMatcher(t *testing.T) { @@ -519,23 +490,9 @@ func TestPathMatcher(t *testing.T) {
}
}
func TestQueryMatcher(t *testing.T) {
for _, v := range queryMatcherTests {
request, _ := http.NewRequest("GET", v.url, nil)
var routeMatch RouteMatch
result := v.matcher.Match(request, &routeMatch)
if result != v.result {
if v.result {
t.Errorf("%#v: should match %v.", v.matcher, v.url)
} else {
t.Errorf("%#v: should not match %v.", v.matcher, v.url)
}
}
}
}
func TestSchemeMatcher(t *testing.T) {
for _, v := range queryMatcherTests {
for _, v := range schemeMatcherTests {
request, _ := http.NewRequest("GET", v.url, nil)
var routeMatch RouteMatch
result := v.matcher.Match(request, &routeMatch)

Loading…
Cancel
Save