From 67df33f50069445d53d373790e8c636e47013a72 Mon Sep 17 00:00:00 2001 From: Anthony Fok Date: Wed, 11 Mar 2015 11:34:57 -0600 Subject: 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. --- helpers/url_test.go | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'helpers/url_test.go') diff --git a/helpers/url_test.go b/helpers/url_test.go index c38750a63..35ade94e5 100644 --- a/helpers/url_test.go +++ b/helpers/url_test.go @@ -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) { -- cgit v1.2.3