hugolib: Add a site benchmark

This commit is contained in:
Bjørn Erik Pedersen 2019-08-16 16:21:03 +02:00
parent f28efd3582
commit 416493b548
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
2 changed files with 9730 additions and 0 deletions

View file

@ -15,6 +15,7 @@ package hugolib
import (
"fmt"
"io/ioutil"
"path"
"path/filepath"
"strconv"
@ -117,6 +118,33 @@ Some content.
s.AssertFileContent("public/tags/ta3/index.html", "|ta3|")
},
},
{"Markdown", func(b testing.TB) *sitesBuilder {
sb := newTestSitesBuilder(b).WithConfigFile("toml", `
title = "What is Markdown"
baseURL = "https://example.com"
`)
data, err := ioutil.ReadFile(filepath.FromSlash("testdata/what-is-markdown.md"))
sb.Assert(err, qt.IsNil)
datastr := string(data)
getContent := func(i int) string {
return fmt.Sprintf(`---
title: "Page %d"
---
`, i) + datastr
}
for i := 1; i <= 100; i++ {
sb.WithContent(fmt.Sprintf("content/page%d.md", i), getContent(i))
}
return sb
},
func(s *sitesBuilder) {
s.Assert(s.CheckExists("public/page8/index.html"), qt.Equals, true)
},
},
{"Canonify URLs", func(b testing.TB) *sitesBuilder {
sb := newTestSitesBuilder(b).WithConfigFile("toml", `
title = "Canon"

9702
hugolib/testdata/what-is-markdown.md vendored Normal file

File diff suppressed because it is too large Load diff