aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib/paginator_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-02-01 16:35:41 +0100
committerBjørn Erik Pedersen <[email protected]>2024-02-01 19:53:51 +0100
commit8d42a7942ad2cc3ecff2ad90502c7e9e87da5d52 (patch)
treed5c91d1e063eb60138084b80d22073fe5a89e750 /hugolib/paginator_test.go
parent4174a7866b75c6ae10827cc77dbae0676af8e5eb (diff)
downloadhugo-8d42a7942ad2cc3ecff2ad90502c7e9e87da5d52.tar.gz
hugo-8d42a7942ad2cc3ecff2ad90502c7e9e87da5d52.zip
Improve nilpointer error message
Diffstat (limited to 'hugolib/paginator_test.go')
-rw-r--r--hugolib/paginator_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/hugolib/paginator_test.go b/hugolib/paginator_test.go
index 2ce07805e..fb592bed1 100644
--- a/hugolib/paginator_test.go
+++ b/hugolib/paginator_test.go
@@ -170,3 +170,15 @@ Paginator: {{ .Paginator }}
b.Assert(err, qt.IsNotNil)
b.Assert(err.Error(), qt.Contains, `error calling Paginator: pagination not supported for this page: kind: "page"`)
}
+
+func TestNilPointerErrorMessage(t *testing.T) {
+ files := `
+-- hugo.toml --
+-- content/p1.md --
+-- layouts/_default/single.html --
+Home Filename: {{ site.Home.File.Filename }}
+`
+ b, err := TestE(t, files)
+ b.Assert(err, qt.IsNotNil)
+ b.Assert(err.Error(), qt.Contains, `_default/single.html:1:22: executing "_default/single.html" – File is nil; wrap it in if or with: {{ with site.Home.File }}{{ .Filename }}{{ end }}`)
+}