hugolib: Support regular pages in .Site.GetPage

Fixes #2844
This commit is contained in:
Bjørn Erik Pedersen
2017-05-25 12:32:02 +03:00
parent 87203139c3
commit e0c2e79820
3 changed files with 175 additions and 37 deletions

View File

@@ -1105,33 +1105,3 @@ func TestSourceRelativeLinkFileing(t *testing.T) {
}
}
}
func BenchmarkGetPage(b *testing.B) {
var (
cfg, fs = newTestCfg()
)
for i := 0; i < 10; i++ {
for j := 0; j < 100; j++ {
writeSource(b, fs, filepath.Join("content", fmt.Sprintf("sect%d", i), fmt.Sprintf("page%d.md", j)), "CONTENT")
}
}
s := buildSingleSite(b, deps.DepsCfg{Fs: fs, Cfg: cfg}, BuildCfg{SkipRender: true})
b.ResetTimer()
for i := 0; i < b.N; i++ {
home := s.getPage(KindHome)
if home == nil {
b.Fatal("Home is nil")
}
for i := 0; i < 10; i++ {
sect := fmt.Sprintf("sect%d", i)
p := s.getPage(KindSection, sect)
if p == nil {
b.Fatal(fmt.Sprintf("Section %q is nil", sect))
}
}
}
}