mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
hugolib: Add a benchmark
This commit is contained in:
parent
20ec9fa2bb
commit
0cf85c071a
1 changed files with 25 additions and 3 deletions
|
@ -47,19 +47,22 @@ This is [Relative](/all-is-relative).
|
||||||
See my [About](/about/) page for details.
|
See my [About](/about/) page for details.
|
||||||
`
|
`
|
||||||
|
|
||||||
pageContent := func(size int) string {
|
pageContentForMarkdown := func(size int, markdown string) string {
|
||||||
return `---
|
return `---
|
||||||
title: "My Page"
|
title: "My Page"
|
||||||
---
|
---
|
||||||
|
|
||||||
My page content.
|
My page content.
|
||||||
|
|
||||||
` + strings.Repeat(markdownSnippets, size)
|
` + strings.Repeat(markdown, size)
|
||||||
|
}
|
||||||
|
|
||||||
|
pageContent := func(size int) string {
|
||||||
|
return pageContentForMarkdown(size, markdownSnippets)
|
||||||
}
|
}
|
||||||
|
|
||||||
config := `
|
config := `
|
||||||
baseURL = "https://example.com"
|
baseURL = "https://example.com"
|
||||||
|
|
||||||
`
|
`
|
||||||
|
|
||||||
benchmarks := []siteBenchmarkTestcase{
|
benchmarks := []siteBenchmarkTestcase{
|
||||||
|
@ -162,6 +165,25 @@ canonifyURLs = true
|
||||||
s.AssertFileContent("public/page8/index.html", "https://example.com/about/")
|
s.AssertFileContent("public/page8/index.html", "https://example.com/about/")
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{"Code Fences", func(b testing.TB) *sitesBuilder {
|
||||||
|
sb := newTestSitesBuilder(b).WithConfigFile("toml", `
|
||||||
|
title = "Code"
|
||||||
|
baseURL = "https://example.com"
|
||||||
|
pygmentsCodeFences = true
|
||||||
|
|
||||||
|
`)
|
||||||
|
markdown := "\n```bash\n" + `echo "Hugo Rocks!"` + "\n```\n\n"
|
||||||
|
|
||||||
|
for i := 1; i <= 100; i++ {
|
||||||
|
sb.WithContent(fmt.Sprintf("content/page%d.md", i), pageContentForMarkdown(i, markdown))
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb
|
||||||
|
},
|
||||||
|
func(s *sitesBuilder) {
|
||||||
|
s.AssertFileContent("public/page8/index.html", `<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">echo <span style="color:#e6db74">"Hugo Rocks!"</span></code></pre></div>`)
|
||||||
|
},
|
||||||
|
},
|
||||||
{"Deep content tree", func(b testing.TB) *sitesBuilder {
|
{"Deep content tree", func(b testing.TB) *sitesBuilder {
|
||||||
|
|
||||||
sb := newTestSitesBuilder(b).WithConfigFile("toml", `
|
sb := newTestSitesBuilder(b).WithConfigFile("toml", `
|
||||||
|
|
Loading…
Reference in a new issue