summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-08-15 10:30:37 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-08-15 10:30:37 +0200
commit028b992611209b241b1f55def8d47f9188038dc3 (patch)
treec4cd99c46e9e787d23862fe199c1633c305b54b3
parent9475f61a377fcf23f910cbfd4ddca59261326665 (diff)
hugolib: Add some outputs tests
See #6210
-rw-r--r--hugolib/site_output_test.go50
1 files changed, 50 insertions, 0 deletions
diff --git a/hugolib/site_output_test.go b/hugolib/site_output_test.go
index f0fa02d7e..7fb53b0f8 100644
--- a/hugolib/site_output_test.go
+++ b/hugolib/site_output_test.go
@@ -575,3 +575,53 @@ Output Formats: {{ len .OutputFormats }};{{ range .OutputFormats }}{{ .Name }};{
)
}
+
+func TestSiteWithPageNoOutputs(t *testing.T) {
+ t.Parallel()
+
+ b := newTestSitesBuilder(t)
+ b.WithConfigFile("toml", `
+baseURL = "https://example.com"
+
+[outputFormats.o1]
+mediaType = "text/html"
+
+
+
+`)
+ b.WithContent("outputs-empty.md", `---
+title: "Empty Outputs"
+outputs: []
+---
+
+Word1. Word2.
+
+`,
+ "outputs-string.md", `---
+title: "Outputs String"
+outputs: "o1"
+---
+
+Word1. Word2.
+
+`)
+
+ b.WithTemplates("index.html", `
+{{ range .Site.RegularPages }}
+WordCount: {{ .WordCount }}
+{{ end }}
+`)
+
+ b.WithTemplates("_default/single.html", `HTML: {{ .Content }}`)
+ b.WithTemplates("_default/single.o1.html", `O1: {{ .Content }}`)
+
+ b.Build(BuildCfg{})
+
+ b.AssertFileContent(
+ "public/index.html",
+ " WordCount: 2")
+
+ b.AssertFileContent("public/outputs-empty/index.html", "HTML:", "Word1. Word2.")
+ b.AssertFileContent("public/outputs-string/index.html", "O1:", "Word1. Word2.")
+
+}