summaryrefslogtreecommitdiffstats
path: root/hugolib/template_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-02-06 23:07:48 +0700
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-02-07 00:01:28 +0700
commitd11f37d97cb3b1298f04f2fbc6ba643d93509b35 (patch)
tree736c0ed611fc1de87638ff9639dd106fccaf3f18 /hugolib/template_test.go
parent3e5ad4aeebed8cb601e7b478821579f823fbef09 (diff)
hugolib: Add some baseof test variants
See #2995
Diffstat (limited to 'hugolib/template_test.go')
-rw-r--r--hugolib/template_test.go22
1 files changed, 21 insertions, 1 deletions
diff --git a/hugolib/template_test.go b/hugolib/template_test.go
index 2690b172a..fa27dfc66 100644
--- a/hugolib/template_test.go
+++ b/hugolib/template_test.go
@@ -42,9 +42,16 @@ func TestBaseGoTemplate(t *testing.T) {
writeSource(t, fs, filepath.Join("layouts", "section", "sect-baseof.html"), `Base: {{block "main" .}}block{{end}}`)
writeSource(t, fs, filepath.Join("layouts", "section", "sect.html"), `{{define "main"}}sect{{ end }}`)
+ // See #2995
+ writeSource(t, fs, filepath.Join("layouts", "sect", "single.html"), `{{define "main"}}single sect{{ end }}`)
+
+ // Should not be picked.
+ writeSource(t, fs, filepath.Join("layouts", "_default", "baseof.html"), `Base: {{block "main" .}}NO{{end}}`)
+
},
func(t *testing.T) {
assertFileContent(t, fs, filepath.Join("public", "sect", "index.html"), false, "Base: sect")
+ assertFileContent(t, fs, filepath.Join("public", "sect", "page", "index.html"), false, "Base: single sect")
},
},
{
@@ -52,7 +59,6 @@ func TestBaseGoTemplate(t *testing.T) {
func(t *testing.T) {
writeSource(t, fs, filepath.Join("layouts", "baseof.html"), `Base: {{block "main" .}}block{{end}}`)
writeSource(t, fs, filepath.Join("layouts", "index.html"), `{{define "main"}}index{{ end }}`)
-
},
func(t *testing.T) {
assertFileContent(t, fs, filepath.Join("public", "index.html"), false, "Base: index")
@@ -88,9 +94,16 @@ func TestBaseGoTemplate(t *testing.T) {
writeSource(t, fs, filepath.Join("themes", "mytheme", "layouts", "section", "sect-baseof.html"), `Base Theme: {{block "main" .}}block{{end}}`)
writeSource(t, fs, filepath.Join("layouts", "section", "sect.html"), `{{define "main"}}sect{{ end }}`)
+ // See #2995
+ writeSource(t, fs, filepath.Join("themes", "mytheme", "layouts", "sect", "single.html"), `{{define "main"}}single sect{{ end }}`)
+
+ // Should not be picked.
+ writeSource(t, fs, filepath.Join("themes", "mytheme", "layouts", "_default", "baseof.html"), `Base: {{block "main" .}}NO{{end}}`)
+
},
func(t *testing.T) {
assertFileContent(t, fs, filepath.Join("public", "sect", "index.html"), false, "Base: sect")
+ assertFileContent(t, fs, filepath.Join("public", "sect", "page", "index.html"), false, "Base: single sect")
},
},
{
@@ -100,9 +113,16 @@ func TestBaseGoTemplate(t *testing.T) {
writeSource(t, fs, filepath.Join("themes", "mytheme", "layouts", "section", "sect-baseof.html"), `Base Theme: {{block "main" .}}block{{end}}`)
writeSource(t, fs, filepath.Join("layouts", "section", "sect.html"), `{{define "main"}}sect{{ end }}`)
+ // See #2995
+ writeSource(t, fs, filepath.Join("themes", "mytheme", "layouts", "sect", "single.html"), `{{define "main"}}single sect{{ end }}`)
+
+ // Should not be picked.
+ writeSource(t, fs, filepath.Join("themes", "mytheme", "layouts", "_default", "baseof.html"), `Base: {{block "main" .}}NO{{end}}`)
+
},
func(t *testing.T) {
assertFileContent(t, fs, filepath.Join("public", "sect", "index.html"), false, "Base Theme: sect")
+ assertFileContent(t, fs, filepath.Join("public", "sect", "page", "index.html"), false, "Base: single sect")
},
},
{