summaryrefslogtreecommitdiffstats
path: root/hugolib
diff options
context:
space:
mode:
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/404_test.go2
-rw-r--r--hugolib/alias.go1
-rw-r--r--hugolib/alias_test.go6
-rw-r--r--hugolib/breaking_changes_test.go11
-rw-r--r--hugolib/cascade_test.go11
-rw-r--r--hugolib/case_insensitive_test.go2
-rw-r--r--hugolib/config.go11
-rw-r--r--hugolib/config_test.go6
-rw-r--r--hugolib/configdir_test.go2
-rw-r--r--hugolib/content_map.go14
-rw-r--r--hugolib/content_map_page.go8
-rw-r--r--hugolib/content_map_test.go12
-rw-r--r--hugolib/content_render_hooks_test.go11
-rw-r--r--hugolib/datafiles_test.go13
-rw-r--r--hugolib/disableKinds_test.go8
-rw-r--r--hugolib/embedded_shortcodes_test.go10
-rw-r--r--hugolib/embedded_templates_test.go1
-rw-r--r--hugolib/fileInfo.go2
-rw-r--r--hugolib/filesystems/basefs.go18
-rw-r--r--hugolib/filesystems/basefs_test.go4
-rw-r--r--hugolib/gitinfo.go1
-rw-r--r--hugolib/hugo_modules_test.go28
-rw-r--r--hugolib/hugo_sites.go15
-rw-r--r--hugolib/hugo_sites_build.go12
-rw-r--r--hugolib/hugo_sites_build_errors_test.go10
-rw-r--r--hugolib/hugo_sites_build_test.go20
-rw-r--r--hugolib/hugo_sites_multihost_test.go3
-rw-r--r--hugolib/hugo_sites_rebuild_test.go8
-rw-r--r--hugolib/hugo_smoke_test.go4
-rw-r--r--hugolib/image_test.go4
-rw-r--r--hugolib/js_test.go2
-rw-r--r--hugolib/language_content_dir_test.go11
-rw-r--r--hugolib/language_test.go1
-rw-r--r--hugolib/menu_test.go10
-rw-r--r--hugolib/multilingual.go4
-rw-r--r--hugolib/openapi_test.go1
-rw-r--r--hugolib/page.go11
-rw-r--r--hugolib/page__content.go1
-rw-r--r--hugolib/page__data.go1
-rw-r--r--hugolib/page__menus.go3
-rw-r--r--hugolib/page__meta.go9
-rw-r--r--hugolib/page__new.go9
-rw-r--r--hugolib/page__output.go4
-rw-r--r--hugolib/page__paginator.go2
-rw-r--r--hugolib/page__paths.go6
-rw-r--r--hugolib/page__per_output.go8
-rw-r--r--hugolib/page__position.go1
-rw-r--r--hugolib/page__ref.go2
-rw-r--r--hugolib/page__tree.go3
-rw-r--r--hugolib/page_kinds.go7
-rw-r--r--hugolib/page_permalink_test.go3
-rw-r--r--hugolib/page_test.go39
-rw-r--r--hugolib/pagebundler_test.go29
-rw-r--r--hugolib/pagecollections.go2
-rw-r--r--hugolib/pagecollections_test.go18
-rw-r--r--hugolib/pages_capture.go18
-rw-r--r--hugolib/pages_capture_test.go5
-rw-r--r--hugolib/pages_language_merge_test.go1
-rw-r--r--hugolib/pages_process.go2
-rw-r--r--hugolib/pages_test.go14
-rw-r--r--hugolib/paginator_test.go2
-rw-r--r--hugolib/paths/paths.go3
-rw-r--r--hugolib/permalinker.go4
-rw-r--r--hugolib/resource_chain_babel_test.go1
-rw-r--r--hugolib/resource_chain_test.go28
-rw-r--r--hugolib/robotstxt_test.go1
-rw-r--r--hugolib/shortcode.go34
-rw-r--r--hugolib/shortcode_test.go119
-rw-r--r--hugolib/site.go36
-rw-r--r--hugolib/siteJSONEncode_test.go1
-rw-r--r--hugolib/site_benchmark_new_test.go230
-rw-r--r--hugolib/site_output.go3
-rw-r--r--hugolib/site_output_test.go16
-rw-r--r--hugolib/site_render.go11
-rw-r--r--hugolib/site_sections_test.go9
-rw-r--r--hugolib/site_stats_test.go4
-rw-r--r--hugolib/site_test.go32
-rw-r--r--hugolib/site_url_test.go7
-rw-r--r--hugolib/sitemap_test.go7
-rw-r--r--hugolib/taxonomy_test.go17
-rw-r--r--hugolib/template_test.go34
-rw-r--r--hugolib/testhelpers_test.go38
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.