Added the url modules test files.

Added the new url module test file. This replaces the original
helpers_test.go file.

The TestUrlPrep test currently fails.

The only minor change to url.go is to add some trace printf's to
UrlPrep.
This commit is contained in:
Owen Waller 2014-09-10 18:43:02 +01:00 committed by spf13
parent 57cd953997
commit 6b619d2cd6
2 changed files with 102 additions and 0 deletions

View file

@ -81,6 +81,7 @@ func MakePermalink(host, plink string) *url.URL {
func UrlPrep(ugly bool, in string) string {
if ugly {
x := Uglify(SanitizeUrl(in))
fmt.Printf("Ugly case. Returning x = %q\n", x)
return x
} else {
x := PrettifyUrl(SanitizeUrl(in))
@ -89,8 +90,10 @@ func UrlPrep(ugly bool, in string) string {
}
url, err := purell.NormalizeURLString(x, purell.FlagAddTrailingSlash)
if err != nil {
fmt.Printf("ERROR returned by NormalizeURLString. Returning in = %q\n", in)
return in
}
fmt.Printf("NO error returning url = %q\n", url)
return url
}
}