config: Add some more merge tests - hugo - [fork] hugo port for 9front
HTML git clone git@git.drkhsh.at/hugo.git
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit b39b24962350090122b5f3927456dde710cffb57
DIR parent d799c045fd74e352edb606f26d21ded74fecb79d
HTML Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date: Fri, 2 May 2025 09:35:19 +0200
config: Add some more merge tests
See #13681
Diffstat:
M config/allconfig/allconfig_integra… | 63 +++++++++++++++++++++++++++++++
1 file changed, 63 insertions(+), 0 deletions(-)
---
DIR diff --git a/config/allconfig/allconfig_integration_test.go b/config/allconfig/allconfig_integration_test.go
@@ -273,6 +273,69 @@ GA ID: {{ site.Config.Services.GoogleAnalytics.ID }}.
b.AssertFileContent("public/index.html", "GA ID: foo bar.")
}
+func TestMergeDeepBuildStats(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+baseURL = "https://example.com"
+title = "Theme 1"
+_merge = "deep"
+[module]
+[module.hugoVersion]
+[[module.imports]]
+path = "theme1"
+-- themes/theme1/hugo.toml --
+[build]
+[build.buildStats]
+disableIDs = true
+enable = true
+-- layouts/home.html --
+Home.
+
+`
+
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs())
+
+ conf := b.H.Configs
+ base := conf.Base
+
+ b.Assert(base.Title, qt.Equals, "Theme 1")
+ b.Assert(len(base.Module.Imports), qt.Equals, 1)
+ b.Assert(base.Build.BuildStats.Enable, qt.Equals, true)
+ b.AssertFileExists("/hugo_stats.json", true)
+}
+
+func TestMergeDeepBuildStatsTheme(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+baseURL = "https://example.com"
+_merge = "deep"
+theme = ["theme1"]
+-- themes/theme1/hugo.toml --
+title = "Theme 1"
+[build]
+[build.buildStats]
+disableIDs = true
+enable = true
+-- layouts/home.html --
+Home.
+
+`
+
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs())
+
+ conf := b.H.Configs
+ base := conf.Base
+
+ b.Assert(base.Title, qt.Equals, "Theme 1")
+ b.Assert(len(base.Module.Imports), qt.Equals, 1)
+ b.Assert(base.Build.BuildStats.Enable, qt.Equals, true)
+ b.AssertFileExists("/hugo_stats.json", true)
+}
+
func TestDefaultConfigLanguageBlankWhenNoEnglishExists(t *testing.T) {
t.Parallel()