mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
hugolib: Add a site benchmark
This commit is contained in:
parent
f28efd3582
commit
416493b548
2 changed files with 9730 additions and 0 deletions
|
@ -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
9702
hugolib/testdata/what-is-markdown.md
vendored
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue