diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-05-08 10:10:13 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-05-08 16:52:51 +0200 |
commit | 086ae81a98149de6b220cc7e2f155d15f0bc17e3 (patch) | |
tree | 3784e998e8fa52bae70e3c5737e3acaf6b865897 /hugolib/pagination_test.go | |
parent | c2bb62d63eb17e00b692b56f0ef2abf7db6009cf (diff) |
hugolib: Fix possible .Content cut
There have been one report of a site with truncated `.Content` after the Hugo `0.40.1` release.
This commit fixes this so that race should not be possible anymore. It also adds a stress test with focus on content rendering and multiple output formats.
Fixes #4706
Diffstat (limited to 'hugolib/pagination_test.go')
-rw-r--r-- | hugolib/pagination_test.go | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/hugolib/pagination_test.go b/hugolib/pagination_test.go index edfac3f3e..61668c3df 100644 --- a/hugolib/pagination_test.go +++ b/hugolib/pagination_test.go @@ -279,8 +279,8 @@ func doTestPaginator(t *testing.T, useViper bool) { require.NoError(t, err) pages := createTestPages(s, 12) - n1, _ := newPageOutput(s.newHomePage(), false, output.HTMLFormat) - n2, _ := newPageOutput(s.newHomePage(), false, output.HTMLFormat) + n1, _ := newPageOutput(s.newHomePage(), false, false, output.HTMLFormat) + n2, _ := newPageOutput(s.newHomePage(), false, false, output.HTMLFormat) n1.Data["Pages"] = pages var paginator1 *Pager @@ -306,7 +306,7 @@ func doTestPaginator(t *testing.T, useViper bool) { require.Equal(t, paginator1, samePaginator) pp, _ := s.NewPage("test") - p, _ := newPageOutput(pp, false, output.HTMLFormat) + p, _ := newPageOutput(pp, false, false, output.HTMLFormat) _, err = p.Paginator() require.NotNil(t, err) @@ -315,7 +315,7 @@ func doTestPaginator(t *testing.T, useViper bool) { func TestPaginatorWithNegativePaginate(t *testing.T) { t.Parallel() s := newTestSite(t, "paginate", -1) - n1, _ := newPageOutput(s.newHomePage(), false, output.HTMLFormat) + n1, _ := newPageOutput(s.newHomePage(), false, false, output.HTMLFormat) _, err := n1.Paginator() require.Error(t, err) } @@ -378,8 +378,8 @@ func doTestPaginate(t *testing.T, useViper bool) { } pages := createTestPages(s, 6) - n1, _ := newPageOutput(s.newHomePage(), false, output.HTMLFormat) - n2, _ := newPageOutput(s.newHomePage(), false, output.HTMLFormat) + n1, _ := newPageOutput(s.newHomePage(), false, false, output.HTMLFormat) + n2, _ := newPageOutput(s.newHomePage(), false, false, output.HTMLFormat) var paginator1, paginator2 *Pager @@ -404,7 +404,7 @@ func doTestPaginate(t *testing.T, useViper bool) { require.Equal(t, paginator2, paginator1.Next()) pp, err := s.NewPage("test") - p, _ := newPageOutput(pp, false, output.HTMLFormat) + p, _ := newPageOutput(pp, false, false, output.HTMLFormat) _, err = p.Paginate(pages) require.NotNil(t, err) @@ -413,7 +413,7 @@ func doTestPaginate(t *testing.T, useViper bool) { func TestInvalidOptions(t *testing.T) { t.Parallel() s := newTestSite(t) - n1, _ := newPageOutput(s.newHomePage(), false, output.HTMLFormat) + n1, _ := newPageOutput(s.newHomePage(), false, false, output.HTMLFormat) _, err := n1.Paginate(createTestPages(s, 1), 1, 2) require.NotNil(t, err) @@ -431,7 +431,7 @@ func TestPaginateWithNegativePaginate(t *testing.T) { s, err := NewSiteForCfg(deps.DepsCfg{Cfg: cfg, Fs: fs}) require.NoError(t, err) - n, _ := newPageOutput(s.newHomePage(), false, output.HTMLFormat) + n, _ := newPageOutput(s.newHomePage(), false, false, output.HTMLFormat) _, err = n.Paginate(createTestPages(s, 2)) require.NotNil(t, err) @@ -458,8 +458,8 @@ func TestPaginatePages(t *testing.T) { func TestPaginatorFollowedByPaginateShouldFail(t *testing.T) { t.Parallel() s := newTestSite(t, "paginate", 10) - n1, _ := newPageOutput(s.newHomePage(), false, output.HTMLFormat) - n2, _ := newPageOutput(s.newHomePage(), false, output.HTMLFormat) + n1, _ := newPageOutput(s.newHomePage(), false, false, output.HTMLFormat) + n2, _ := newPageOutput(s.newHomePage(), false, false, output.HTMLFormat) _, err := n1.Paginator() require.Nil(t, err) @@ -475,8 +475,8 @@ func TestPaginateFollowedByDifferentPaginateShouldFail(t *testing.T) { t.Parallel() s := newTestSite(t, "paginate", 10) - n1, _ := newPageOutput(s.newHomePage(), false, output.HTMLFormat) - n2, _ := newPageOutput(s.newHomePage(), false, output.HTMLFormat) + n1, _ := newPageOutput(s.newHomePage(), false, false, output.HTMLFormat) + n2, _ := newPageOutput(s.newHomePage(), false, false, output.HTMLFormat) p1 := createTestPages(s, 2) p2 := createTestPages(s, 10) |