|
|
|
@ -7,11 +7,24 @@ package mux |
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"net/http" |
|
|
|
"net/http" |
|
|
|
|
|
|
|
"strings" |
|
|
|
"testing" |
|
|
|
"testing" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/gorilla/context" |
|
|
|
"github.com/gorilla/context" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (r *Route) GoString() string { |
|
|
|
|
|
|
|
matchers := make([]string, len(r.matchers)) |
|
|
|
|
|
|
|
for i, m := range r.matchers { |
|
|
|
|
|
|
|
matchers[i] = fmt.Sprintf("%#v", m) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return fmt.Sprintf("&Route{matchers:[]matcher{%s}}", strings.Join(matchers, ", ")) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (r *routeRegexp) GoString() string { |
|
|
|
|
|
|
|
return fmt.Sprintf("&routeRegexp{template: %q, matchHost: %t, matchQuery: %t, strictSlash: %t, regexp: regexp.MustCompile(%q), reverse: %q, varsN: %v, varsR: %v", r.template, r.matchHost, r.matchQuery, r.strictSlash, r.regexp.String(), r.reverse, r.varsN, r.varsR) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type routeTest struct { |
|
|
|
type routeTest struct { |
|
|
|
title string // title of the test
|
|
|
|
title string // title of the test
|
|
|
|
route *Route // the route being tested
|
|
|
|
route *Route // the route being tested
|
|
|
|
|