Correct initialisms as suggested by golint

First step to use initialisms that golint suggests,
for example:

    Line 116: func GetHtmlRenderer should be GetHTMLRenderer

as see on http://goreportcard.com/report/spf13/hugo

Thanks to @bep for the idea!

Note that command-line flags (cobra and pflag)
as well as struct fields like .BaseUrl and .Url
that are used in Go HTML templates need more work
to maintain backward-compatibility, and thus
are NOT yet dealt with in this commit.

First step in fixing #959.
This commit is contained in:
Anthony Fok
2015-03-11 11:34:57 -06:00
committed by bep
parent 00f07c5374
commit 67df33f500
33 changed files with 310 additions and 303 deletions

View File

@@ -19,7 +19,7 @@ func TestUrlize(t *testing.T) {
}
for _, test := range tests {
output := Urlize(test.input)
output := URLize(test.input)
if output != test.expected {
t.Errorf("Expected %#v, got %#v\n", test.expected, output)
}
@@ -36,8 +36,8 @@ func TestSanitizeUrl(t *testing.T) {
}
for _, test := range tests {
o1 := SanitizeUrl(test.input)
o2 := SanitizeUrlKeepTrailingSlash(test.input)
o1 := SanitizeURL(test.input)
o2 := SanitizeURLKeepTrailingSlash(test.input)
expected2 := test.expected
@@ -88,7 +88,7 @@ func TestUrlPrep(t *testing.T) {
{true, "/section/name/index.html", "/section/name.html"},
}
for i, d := range data {
output := UrlPrep(d.ugly, d.input)
output := URLPrep(d.ugly, d.input)
if d.output != output {
t.Errorf("Test #%d failed. Expected %q got %q", i, d.output, output)
}
@@ -98,7 +98,7 @@ func TestUrlPrep(t *testing.T) {
func TestAddContextRoot(t *testing.T) {
tests := []struct {
baseUrl string
baseURL string
url string
expected string
}{
@@ -114,7 +114,7 @@ func TestAddContextRoot(t *testing.T) {
}
for _, test := range tests {
output := AddContextRoot(test.baseUrl, test.url)
output := AddContextRoot(test.baseURL, test.url)
if output != test.expected {
t.Errorf("Expected %#v, got %#v\n", test.expected, output)
}
@@ -122,22 +122,22 @@ func TestAddContextRoot(t *testing.T) {
}
func TestPretty(t *testing.T) {
assert.Equal(t, PrettifyUrlPath("/section/name.html"), "/section/name/index.html")
assert.Equal(t, PrettifyUrlPath("/section/sub/name.html"), "/section/sub/name/index.html")
assert.Equal(t, PrettifyUrlPath("/section/name/"), "/section/name/index.html")
assert.Equal(t, PrettifyUrlPath("/section/name/index.html"), "/section/name/index.html")
assert.Equal(t, PrettifyUrlPath("/index.html"), "/index.html")
assert.Equal(t, PrettifyUrlPath("/name.xml"), "/name/index.xml")
assert.Equal(t, PrettifyUrlPath("/"), "/")
assert.Equal(t, PrettifyUrlPath(""), "/")
assert.Equal(t, PrettifyUrl("/section/name.html"), "/section/name")
assert.Equal(t, PrettifyUrl("/section/sub/name.html"), "/section/sub/name")
assert.Equal(t, PrettifyUrl("/section/name/"), "/section/name")
assert.Equal(t, PrettifyUrl("/section/name/index.html"), "/section/name")
assert.Equal(t, PrettifyUrl("/index.html"), "/")
assert.Equal(t, PrettifyUrl("/name.xml"), "/name/index.xml")
assert.Equal(t, PrettifyUrl("/"), "/")
assert.Equal(t, PrettifyUrl(""), "/")
assert.Equal(t, PrettifyURLPath("/section/name.html"), "/section/name/index.html")
assert.Equal(t, PrettifyURLPath("/section/sub/name.html"), "/section/sub/name/index.html")
assert.Equal(t, PrettifyURLPath("/section/name/"), "/section/name/index.html")
assert.Equal(t, PrettifyURLPath("/section/name/index.html"), "/section/name/index.html")
assert.Equal(t, PrettifyURLPath("/index.html"), "/index.html")
assert.Equal(t, PrettifyURLPath("/name.xml"), "/name/index.xml")
assert.Equal(t, PrettifyURLPath("/"), "/")
assert.Equal(t, PrettifyURLPath(""), "/")
assert.Equal(t, PrettifyURL("/section/name.html"), "/section/name")
assert.Equal(t, PrettifyURL("/section/sub/name.html"), "/section/sub/name")
assert.Equal(t, PrettifyURL("/section/name/"), "/section/name")
assert.Equal(t, PrettifyURL("/section/name/index.html"), "/section/name")
assert.Equal(t, PrettifyURL("/index.html"), "/")
assert.Equal(t, PrettifyURL("/name.xml"), "/name/index.xml")
assert.Equal(t, PrettifyURL("/"), "/")
assert.Equal(t, PrettifyURL(""), "/")
}
func TestUgly(t *testing.T) {