diff options
author | Bjørn Erik Pedersen <[email protected]> | 2020-01-23 17:34:19 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2020-01-23 19:54:06 +0100 |
commit | f441f675126ef1123d9f94429872dd683b40e011 (patch) | |
tree | 29cd3f57ac5b69e91859f4577667686f8218877a /hugolib/template_test.go | |
parent | 7ed22e9fb6a5b74c52ae6054b843b8c64e83f4b6 (diff) | |
download | hugo-f441f675126ef1123d9f94429872dd683b40e011.tar.gz hugo-f441f675126ef1123d9f94429872dd683b40e011.zip |
Fix baseof with regular define regression
Fixes #6790
Diffstat (limited to 'hugolib/template_test.go')
-rw-r--r-- | hugolib/template_test.go | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/hugolib/template_test.go b/hugolib/template_test.go index e75bda790..44566f5a7 100644 --- a/hugolib/template_test.go +++ b/hugolib/template_test.go @@ -361,6 +361,43 @@ Base %d: {{ block "main" . }}FOO{{ end }} } +// https://github.com/gohugoio/hugo/issues/6790 +func TestTemplateNoBasePlease(t *testing.T) { + t.Parallel() + b := newTestSitesBuilder(t).WithSimpleConfigFile() + + b.WithTemplates("_default/list.html", ` + {{ define "main" }} + Bonjour + {{ end }} + + {{ printf "list" }} + + + `) + + b.WithTemplates( + "_default/single.html", ` +{{ printf "single" }} +{{ define "main" }} + Bonjour +{{ end }} + + +`) + + b.WithContent("blog/p1.md", `--- +title: The Page +--- +`) + + b.Build(BuildCfg{}) + + b.AssertFileContent("public/blog/p1/index.html", `single`) + b.AssertFileContent("public/blog/index.html", `list`) + +} + func TestTemplateLookupSite(t *testing.T) { t.Run("basic", func(t *testing.T) { t.Parallel() |