From 407c24020ef2db90cf33fd07e7522b2257013722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Fri, 29 Dec 2017 10:16:50 +0100 Subject: [PATCH] hugolib: Add test for homepage content for all rendering engines Update #4166 --- hugolib/page_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hugolib/page_test.go b/hugolib/page_test.go index 769d29833..0b4a0a463 100644 --- a/hugolib/page_test.go +++ b/hugolib/page_test.go @@ -35,6 +35,7 @@ import ( var emptyPage = "" const ( + homePage = "---\ntitle: Home\n---\nHome Page Content\n" simplePage = "---\ntitle: Simple\n---\nSimple Page\n" invalidFrontMatterMissing = "This is a test" renderNoFrontmatter = "This is a test" @@ -595,12 +596,22 @@ func testAllMarkdownEnginesForPages(t *testing.T, writeSource(t, fs, filepath.Join(contentDir, fileSourcePairs[i]), fileSourcePairs[i+1]) } + // Add a content page for the home page + homePath := fmt.Sprintf("_index.%s", e.ext) + writeSource(t, fs, filepath.Join(contentDir, homePath), homePage) + s := buildSingleSite(t, deps.DepsCfg{Fs: fs, Cfg: cfg}, BuildCfg{SkipRender: true}) require.Len(t, s.RegularPages, len(pageSources)) assertFunc(t, e.ext, s.RegularPages) + home, err := s.Info.Home() + require.NoError(t, err) + require.NotNil(t, home) + require.Equal(t, homePath, home.Path()) + require.Contains(t, home.Content, "Home Page Content") + } }