hugolib: Fix Related when called from shortcode

Fixes #5071
This commit is contained in:
Bjørn Erik Pedersen
2018-08-14 18:11:36 +02:00
parent 5c5384916e
commit 0dd06bdac0
2 changed files with 19 additions and 7 deletions

View File

@@ -150,6 +150,17 @@ func TestPositionalParamIndexOutOfBounds(t *testing.T) {
CheckShortCodeMatch(t, "{{< video 47238zzb >}}", "Playing Video Missing", wt)
}
// #5071
func TestShortcodeRelated(t *testing.T) {
t.Parallel()
wt := func(tem tpl.TemplateHandler) error {
tem.AddTemplate("_internal/shortcodes/a.html", `{{ len (.Site.RegularPages.Related .Page) }}`)
return nil
}
CheckShortCodeMatch(t, "{{< a >}}", "0", wt)
}
// some repro issues for panics in Go Fuzz testing
func TestNamedParamSC(t *testing.T) {