Skip to content

Commit

Permalink
hugolib: Add a site benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed Aug 16, 2019
1 parent f28efd3 commit 416493b
Show file tree
Hide file tree
Showing 2 changed files with 9,730 additions and 0 deletions.
28 changes: 28 additions & 0 deletions hugolib/site_benchmark_new_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package hugolib

import (
"fmt"
"io/ioutil"
"path"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -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"
Expand Down
Loading

0 comments on commit 416493b

Please sign in to comment.