diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-08-14 18:11:36 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-08-14 18:11:36 +0200 |
commit | 0dd06bdac008aa81ec2e8f29ad8110dac0227011 (patch) | |
tree | 513b6bd55150a85c888b801bab7e60285eea7eb2 /hugolib/shortcode_test.go | |
parent | 5c5384916e8f954f3ea66148ecceb3732584588e (diff) |
hugolib: Fix Related when called from shortcode
Fixes #5071
Diffstat (limited to 'hugolib/shortcode_test.go')
-rw-r--r-- | hugolib/shortcode_test.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/hugolib/shortcode_test.go b/hugolib/shortcode_test.go index f4935c6e9..d57dca82e 100644 --- a/hugolib/shortcode_test.go +++ b/hugolib/shortcode_test.go @@ -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) { |