Browse Source

slightly improve printing of regexps in failed tests.

Kamil Kisiel 10 years ago
parent
commit
5112c33f3a
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      mux_test.go

+ 13
- 0
mux_test.go View File

@ -7,11 +7,24 @@ package mux
import (
"fmt"
"net/http"
"strings"
"testing"
"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 {
title string // title of the test
route *Route // the route being tested


Loading…
Cancel
Save