aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib/site_sections_test.go
diff options
context:
space:
mode:
authorCameron Moore <[email protected]>2018-10-02 21:46:32 -0500
committerBjørn Erik Pedersen <[email protected]>2018-10-03 09:33:42 +0300
commit498d6299581bead0f582431b8133d8b5f8760618 (patch)
treecd7cdda367d5b27e9ad50b861743c9a580b36397 /hugolib/site_sections_test.go
parent10ac2ec4466090957e1f6897906ddeb1e0b13673 (diff)
downloadhugo-498d6299581bead0f582431b8133d8b5f8760618.tar.gz
hugo-498d6299581bead0f582431b8133d8b5f8760618.zip
hugolib: Allow nil to be unwrapped as *Page
Previously, calls to *Page.Eq(nil) would always return false because the unwrapPage func didn't support the nil case. Add support for unwrapping nil to a *Page. Fixes #5043
Diffstat (limited to 'hugolib/site_sections_test.go')
-rw-r--r--hugolib/site_sections_test.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/hugolib/site_sections_test.go b/hugolib/site_sections_test.go
index 86ae4080c..24bb6a91f 100644
--- a/hugolib/site_sections_test.go
+++ b/hugolib/site_sections_test.go
@@ -166,6 +166,11 @@ PAG|{{ .Title }}|{{ $sect.InSection . }}
assert.Equal("empty3.md", b.Pages[0].File.LogicalName())
}},
+ {"empty3", func(p *Page) {
+ xxx := p.s.getPage(KindPage, "empty3", "nil")
+ assert.Nil(xxx)
+ assert.Equal(xxx.Eq(nil), true)
+ }},
{"top", func(p *Page) {
assert.Equal("Tops", p.title)
assert.Len(p.Pages, 2)