hugolib: Add a test for home page with no title

See #5784
This commit is contained in:
Bjørn Erik Pedersen 2019-03-26 10:28:02 +01:00
parent 4dae52af68
commit bceda1b288
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F

View file

@ -1174,6 +1174,20 @@ func TestPageWithZeroFile(t *testing.T) {
WithTemplatesAdded("index.html", "{{ .File.Filename }}{{ with .File }}{{ .Dir }}{{ end }}").Build(BuildCfg{})
}
func TestHomePageWithNoTitle(t *testing.T) {
b := newTestSitesBuilder(t).WithSimpleConfigFile().
WithTemplatesAdded("index.html", "Title|{{ with .Title }}{{ . }}{{ end }}|")
b.WithContent("_index.md", `---
description: "No title for you!"
---
Content.
`)
b.Build(BuildCfg{})
b.AssertFileContent("public/index.html", "Title||")
}
func TestShouldBuild(t *testing.T) {
t.Parallel()
var past = time.Date(2009, 11, 17, 20, 34, 58, 651387237, time.UTC)