mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-16 20:53:59 +02:00
tpl/collections: Fix apply with namespaced template funcs
We changed the signature to `func(...interface{}) (interface{}, error)` some time ago, but sadly we had no test for this for `apply`. Now we do. Fixes #9393
This commit is contained in:
@@ -460,7 +460,6 @@ complex: 80: 80
|
||||
|
||||
// Issue 7528
|
||||
func TestPartialWithZeroedArgs(t *testing.T) {
|
||||
|
||||
b := newTestSitesBuilder(t)
|
||||
b.WithTemplatesAdded("index.html",
|
||||
`
|
||||
@@ -483,7 +482,6 @@ X123X
|
||||
X123X
|
||||
X123X
|
||||
`)
|
||||
|
||||
}
|
||||
|
||||
func TestPartialCached(t *testing.T) {
|
||||
@@ -757,3 +755,20 @@ This is single main
|
||||
`,
|
||||
)
|
||||
}
|
||||
|
||||
// Issue 9393.
|
||||
func TestApplyWithNamespace(t *testing.T) {
|
||||
b := newTestSitesBuilder(t)
|
||||
|
||||
b.WithTemplates(
|
||||
"index.html", `
|
||||
{{ $b := slice " a " " b " " c" }}
|
||||
{{ $a := apply $b "strings.Trim" "." " " }}
|
||||
a: {{ $a }}
|
||||
`,
|
||||
).WithContent("p1.md", "")
|
||||
|
||||
b.Build(BuildCfg{})
|
||||
|
||||
b.AssertFileContent("public/index.html", `a: [a b c]`)
|
||||
}
|
||||
|
Reference in New Issue
Block a user