diff options
Diffstat (limited to 'hugolib/config_test.go')
-rw-r--r-- | hugolib/config_test.go | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/hugolib/config_test.go b/hugolib/config_test.go index 882d83c8d..37605b4c2 100644 --- a/hugolib/config_test.go +++ b/hugolib/config_test.go @@ -782,3 +782,55 @@ defaultMarkdownHandler = 'blackfriday' b.Assert(err.Error(), qt.Contains, "Configured defaultMarkdownHandler \"blackfriday\" not found. Did you mean to use goldmark? Blackfriday was removed in Hugo v0.100.0.") } + +// Issue 8979 +func TestHugoConfig(t *testing.T) { + filesTemplate := ` +-- hugo.toml -- +theme = "mytheme" +[params] +rootparam = "rootvalue" +-- config/_default/hugo.toml -- +[params] +rootconfigparam = "rootconfigvalue" +-- themes/mytheme/config/_default/hugo.toml -- +[params] +themeconfigdirparam = "themeconfigdirvalue" +-- themes/mytheme/hugo.toml -- +[params] +themeparam = "themevalue" +-- layouts/index.html -- +rootparam: {{ site.Params.rootparam }} +rootconfigparam: {{ site.Params.rootconfigparam }} +themeparam: {{ site.Params.themeparam }} +themeconfigdirparam: {{ site.Params.themeconfigdirparam }} + + +` + + for _, configName := range []string{"hugo.toml", "config.toml"} { + configName := configName + t.Run(configName, func(t *testing.T) { + t.Parallel() + + files := strings.ReplaceAll(filesTemplate, "hugo.toml", configName) + + b, err := NewIntegrationTestBuilder( + IntegrationTestConfig{ + T: t, + TxtarString: files, + }, + ).BuildE() + + b.Assert(err, qt.IsNil) + b.AssertFileContent("public/index.html", + "rootparam: rootvalue", + "rootconfigparam: rootconfigvalue", + "themeparam: themevalue", + "themeconfigdirparam: themeconfigdirvalue", + ) + + }) + } + +} |