diff options
Diffstat (limited to 'tpl/collections')
-rw-r--r-- | tpl/collections/apply.go | 2 | ||||
-rw-r--r-- | tpl/collections/apply_test.go | 14 |
2 files changed, 13 insertions, 3 deletions
diff --git a/tpl/collections/apply.go b/tpl/collections/apply.go index d41a3b1da..55d29d3a9 100644 --- a/tpl/collections/apply.go +++ b/tpl/collections/apply.go @@ -106,7 +106,7 @@ func applyFnToThis(fn, this reflect.Value, args ...interface{}) (reflect.Value, func (ns *Namespace) lookupFunc(fname string) (reflect.Value, bool) { if !strings.ContainsRune(fname, '.') { - templ := ns.deps.Tmpl.(tpl.TemplateFuncGetter) + templ := ns.deps.Tmpl().(tpl.TemplateFuncGetter) return templ.GetFunc(fname) } diff --git a/tpl/collections/apply_test.go b/tpl/collections/apply_test.go index 5b21d5a97..0d06f52e8 100644 --- a/tpl/collections/apply_test.go +++ b/tpl/collections/apply_test.go @@ -22,6 +22,7 @@ import ( qt "github.com/frankban/quicktest" "github.com/gohugoio/hugo/deps" + "github.com/gohugoio/hugo/output" "github.com/gohugoio/hugo/tpl" ) @@ -31,10 +32,18 @@ func (templateFinder) Lookup(name string) (tpl.Template, bool) { return nil, false } +func (templateFinder) HasTemplate(name string) bool { + return false +} + func (templateFinder) LookupVariant(name string, variants tpl.TemplateVariants) (tpl.Template, bool, bool) { return nil, false, false } +func (templateFinder) LookupLayout(d output.LayoutDescriptor, f output.Format) (tpl.Template, bool, error) { + return nil, false, nil +} + func (templateFinder) Execute(t tpl.Template, wr io.Writer, data interface{}) error { return nil } @@ -51,8 +60,9 @@ func (templateFinder) GetFunc(name string) (reflect.Value, bool) { func TestApply(t *testing.T) { t.Parallel() c := qt.New(t) - - ns := New(&deps.Deps{Tmpl: new(templateFinder)}) + d := &deps.Deps{} + d.SetTmpl(new(templateFinder)) + ns := New(d) strings := []interface{}{"a\n", "b\n"} |