mirror of
https://github.com/gohugoio/hugo.git
synced 2025-03-15 02:13:58 +00:00
parent
5c5384916e
commit
0dd06bdac0
2 changed files with 19 additions and 7 deletions
|
@ -150,6 +150,17 @@ func TestPositionalParamIndexOutOfBounds(t *testing.T) {
|
||||||
CheckShortCodeMatch(t, "{{< video 47238zzb >}}", "Playing Video Missing", wt)
|
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
|
// some repro issues for panics in Go Fuzz testing
|
||||||
|
|
||||||
func TestNamedParamSC(t *testing.T) {
|
func TestNamedParamSC(t *testing.T) {
|
||||||
|
|
|
@ -145,15 +145,16 @@ func (p *Page) Eq(other interface{}) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func unwrapPage(in interface{}) (*Page, error) {
|
func unwrapPage(in interface{}) (*Page, error) {
|
||||||
if po, ok := in.(*PageOutput); ok {
|
switch v := in.(type) {
|
||||||
in = po.Page
|
case *Page:
|
||||||
}
|
return v, nil
|
||||||
|
case *PageOutput:
|
||||||
pp, ok := in.(*Page)
|
return v.Page, nil
|
||||||
if !ok {
|
case *PageWithoutContent:
|
||||||
|
return v.Page, nil
|
||||||
|
default:
|
||||||
return nil, fmt.Errorf("%T not supported", in)
|
return nil, fmt.Errorf("%T not supported", in)
|
||||||
}
|
}
|
||||||
return pp, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sections returns this section's subsections, if any.
|
// Sections returns this section's subsections, if any.
|
||||||
|
|
Loading…
Reference in a new issue