summaryrefslogtreecommitdiffstats
path: root/hugolib/pagination_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-10-24 13:45:30 +0200
committerGitHub <noreply@github.com>2016-10-24 13:45:30 +0200
commita10b2cd372798c4e4b862f0ec03010d2aea2ff1e (patch)
treef768c420aac0008e4d118709e13fda278a7588c5 /hugolib/pagination_test.go
parentdffd7da07c3fb198acfa6c4664b53132c4cabe55 (diff)
Avoid reading from Viper for path and URL funcs
The gain, given the "real sites benchmark" below, is obvious: ``` benchmark old ns/op new ns/op delta BenchmarkHugo-4 14497594101 13084156335 -9.75% benchmark old allocs new allocs delta BenchmarkHugo-4 57404335 48282002 -15.89% benchmark old bytes new bytes delta BenchmarkHugo-4 9933505624 9721984424 -2.13% ``` Fixes #2495
Diffstat (limited to 'hugolib/pagination_test.go')
-rw-r--r--hugolib/pagination_test.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/hugolib/pagination_test.go b/hugolib/pagination_test.go
index 786650469..7bbc38058 100644
--- a/hugolib/pagination_test.go
+++ b/hugolib/pagination_test.go
@@ -19,6 +19,7 @@ import (
"path/filepath"
"testing"
+ "github.com/spf13/hugo/helpers"
"github.com/spf13/hugo/source"
"github.com/spf13/viper"
"github.com/stretchr/testify/assert"
@@ -453,6 +454,7 @@ func TestPage(t *testing.T) {
func createTestPages(num int) Pages {
pages := make(Pages, num)
+ info := newSiteInfo(siteBuilderCfg{baseURL: "http://base/", language: helpers.NewDefaultLanguage()})
for i := 0; i < num; i++ {
pages[i] = &Page{
Node: Node{
@@ -460,7 +462,7 @@ func createTestPages(num int) Pages {
Section: "z",
URL: fmt.Sprintf("http://base/x/y/p%d.html", i),
},
- Site: newSiteInfoDefaultLanguage("http://base/"),
+ Site: &info,
},
Source: Source{File: *source.NewFile(filepath.FromSlash(fmt.Sprintf("/x/y/p%d.md", i)))},
}