Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-11-17 19:22:32 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-11-17 19:22:32 +0300
commit0cf85c071aba57de8c6567fba166ed8332d01bac (patch)
tree7d5da78de3a2aeaf0dcaae5d5cab8f347f658e05 /hugolib
parent20ec9fa2bbd69dc47dfc9f1db40c954e08520071 (diff)
hugolib: Add a benchmark
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/site_benchmark_new_test.go28
1 files changed, 25 insertions, 3 deletions
diff --git a/hugolib/site_benchmark_new_test.go b/hugolib/site_benchmark_new_test.go
index a9054e824..8220f9d00 100644
--- a/hugolib/site_benchmark_new_test.go
+++ b/hugolib/site_benchmark_new_test.go
@@ -47,19 +47,22 @@ This is [Relative](/all-is-relative).
See my [About](/about/) page for details.
`
- pageContent := func(size int) string {
+ pageContentForMarkdown := func(size int, markdown string) string {
return `---
title: "My Page"
---
My page content.
-` + strings.Repeat(markdownSnippets, size)
+` + strings.Repeat(markdown, size)
+ }
+
+ pageContent := func(size int) string {
+ return pageContentForMarkdown(size, markdownSnippets)
}
config := `
baseURL = "https://example.com"
-
`
benchmarks := []siteBenchmarkTestcase{
@@ -162,6 +165,25 @@ canonifyURLs = true
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">&#34;Hugo Rocks!&#34;</span></code></pre></div>`)
+ },
+ },
{"Deep content tree", func(b testing.TB) *sitesBuilder {
sb := newTestSitesBuilder(b).WithConfigFile("toml", `