diff options
Diffstat (limited to 'hugolib')
82 files changed, 305 insertions, 817 deletions
diff --git a/hugolib/404_test.go b/hugolib/404_test.go index cd203a669..383302e0b 100644 --- a/hugolib/404_test.go +++ b/hugolib/404_test.go @@ -57,7 +57,6 @@ Page: /404.html| Data: 1| `) - } func Test404WithBase(t *testing.T) { @@ -77,5 +76,4 @@ Page not found b.AssertFileContent("public/404.html", ` Base: Page not found`) - } diff --git a/hugolib/alias.go b/hugolib/alias.go index 6272b7910..891098c9d 100644 --- a/hugolib/alias.go +++ b/hugolib/alias.go @@ -47,7 +47,6 @@ type aliasPage struct { } func (a aliasHandler) renderAlias(permalink string, p page.Page) (io.Reader, error) { - var templ tpl.Template var found bool diff --git a/hugolib/alias_test.go b/hugolib/alias_test.go index 8f3b756ec..d5ffc06fe 100644 --- a/hugolib/alias_test.go +++ b/hugolib/alias_test.go @@ -38,8 +38,10 @@ outputs: ["HTML", "AMP", "JSON"] For some moments the old man did not reply. He stood with bowed head, buried in deep thought. But at last he spoke. ` -const basicTemplate = "<html><body>{{.Content}}</body></html>" -const aliasTemplate = "<html><body>ALIASTEMPLATE</body></html>" +const ( + basicTemplate = "<html><body>{{.Content}}</body></html>" + aliasTemplate = "<html><body>ALIASTEMPLATE</body></html>" +) func TestAlias(t *testing.T) { t.Parallel() diff --git a/hugolib/breaking_changes_test.go b/hugolib/breaking_changes_test.go index c935d6e93..a22bc240f 100644 --- a/hugolib/breaking_changes_test.go +++ b/hugolib/breaking_changes_test.go @@ -21,11 +21,9 @@ import ( ) func Test073(t *testing.T) { - asertDisabledTaxonomyAndTerm := func(b *sitesBuilder, taxonomy, term bool) { b.Assert(b.CheckExists("public/tags/index.html"), qt.Equals, taxonomy) b.Assert(b.CheckExists("public/tags/tag1/index.html"), qt.Equals, term) - } assertOutputTaxonomyAndTerm := func(b *sitesBuilder, taxonomy, term bool) { @@ -48,7 +46,6 @@ func Test073(t *testing.T) { func(err error, out string, b *sitesBuilder) { b.Assert(err, qt.IsNil) assertOutputTaxonomyAndTerm(b, true, true) - }, }, { @@ -60,7 +57,6 @@ taxonomyTerm = ["JSON"] func(err error, out string, b *sitesBuilder) { b.Assert(err, qt.IsNil) assertOutputTaxonomyAndTerm(b, true, false) - }, }, { @@ -72,7 +68,6 @@ taxonomy = ["JSON"] func(err error, out string, b *sitesBuilder) { b.Assert(err, qt.Not(qt.IsNil)) b.Assert(out, qt.Contains, `ignoreErrors = ["error-output-taxonomy"]`) - }, }, { @@ -86,7 +81,6 @@ taxonomy = ["JSON"] func(err error, out string, b *sitesBuilder) { b.Assert(err, qt.IsNil) assertOutputTaxonomyAndTerm(b, true, false) - }, }, { @@ -95,7 +89,6 @@ taxonomy = ["JSON"] func(err error, out string, b *sitesBuilder) { b.Assert(err, qt.IsNil) asertDisabledTaxonomyAndTerm(b, false, false) - }, }, { @@ -104,7 +97,6 @@ taxonomy = ["JSON"] func(err error, out string, b *sitesBuilder) { b.Assert(err, qt.IsNil) asertDisabledTaxonomyAndTerm(b, false, true) - }, }, { @@ -125,7 +117,6 @@ taxonomy = ["JSON"] }, }, } { - t.Run(this.name, func(t *testing.T) { b := newTestSitesBuilder(t).WithConfigFile("toml", this.config) b.WithTemplatesAdded("_default/list.json", "JSON") @@ -135,7 +126,5 @@ taxonomy = ["JSON"] fmt.Println(out) this.assert(err, out, b) }) - } - } diff --git a/hugolib/cascade_test.go b/hugolib/cascade_test.go index a112fe10c..78409a4b1 100644 --- a/hugolib/cascade_test.go +++ b/hugolib/cascade_test.go @@ -51,7 +51,6 @@ func BenchmarkCascade(b *testing.B) { } func TestCascade(t *testing.T) { - allLangs := []string{"en", "nn", "nb", "sv"} langs := allLangs[:3] @@ -101,9 +100,7 @@ func TestCascade(t *testing.T) { // Check cascade into bundled page b.AssertFileContent("public/bundle1/index.html", `Resources: bp1.md|home.png|`) - }) - } func TestCascadeEdit(t *testing.T) { @@ -252,7 +249,6 @@ func newCascadeTestBuilder(t testing.TB, langs []string) *sitesBuilder { metaStr := "---\n" + yamlStr + "\n---" return metaStr - } createLangConfig := func(lang string) string { @@ -290,7 +286,6 @@ defaultContentLanguageInSubDir = false b := newTestSitesBuilder(t).WithConfigFile("toml", config) createContentFiles := func(lang string) { - withContent := func(filenameContent ...string) { for i := 0; i < len(filenameContent); i += 2 { b.WithContent(path.Join(lang, filenameContent[i]), filenameContent[i+1]) @@ -414,7 +409,6 @@ S1|p1:{{ $s1.Params.p1 }}|p2:{{ $s1.Params.p2 }}| b.WithContent("s2/p1/index.md", "---\ntitle: p1_2\n---") return b - } c.Run("slice", func(c *qt.C) { @@ -431,7 +425,6 @@ p2 = "p2" b.Build(BuildCfg{}) b.AssertFileContent("public/index.html", "P1|p1:p1|p2:p2") - }) c.Run("slice with _target", func(c *qt.C) { @@ -456,7 +449,6 @@ kind="section" P1|p1:p1|p2:| S1|p1:|p2:p2| `) - }) c.Run("slice with yaml _target", func(c *qt.C) { @@ -480,7 +472,6 @@ cascade: P1|p1:p1|p2:| S1|p1:|p2:p2| `) - }) c.Run("slice with json _target", func(c *qt.C) { @@ -510,7 +501,5 @@ S1|p1:|p2:p2| P1|p1:p1|p2:| S1|p1:|p2:p2| `) - }) - } diff --git a/hugolib/case_insensitive_test.go b/hugolib/case_insensitive_test.go index 42b9d7ef6..9aa88ab5b 100644 --- a/hugolib/case_insensitive_test.go +++ b/hugolib/case_insensitive_test.go @@ -127,7 +127,6 @@ Partial Site Global: {{ site.Params.COLOR }}|{{ site.Params.COLORS.YELLOW }} `) writeToFs(t, fs, "config.toml", caseMixingSiteConfigTOML) - } func TestCaseInsensitiveConfigurationVariations(t *testing.T) { @@ -184,7 +183,6 @@ Page2: {{ $page2.Params.ColoR }} `) sites, err := NewHugoSites(deps.DepsCfg{Fs: fs, Cfg: cfg}) - if err != nil { t.Fatalf("Failed to create sites: %s", err) } diff --git a/hugolib/config.go b/hugolib/config.go index 9acb7d701..5ef78acf4 100644 --- a/hugolib/config.go +++ b/hugolib/config.go @@ -123,7 +123,6 @@ var ErrNoConfigFile = errors.New("Unable to locate config file or config directo // LoadConfig loads Hugo configuration into a new Viper and then adds // a set of defaults. |