diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2019-12-02 23:10:27 +0300 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2019-12-03 02:13:47 +0300 |
commit | 0efb00c2a86ec3f52000a643f26f54bb2a9dfbd6 (patch) | |
tree | 370d64135277eaa825ead0c25d33e99eb218087e /hugolib/template_test.go | |
parent | 40a092b0687d44ecb53ef1fd53001a6299345780 (diff) |
tpl/partials: Allow any key type in partialCached
Fixes #6572
Diffstat (limited to 'hugolib/template_test.go')
-rw-r--r-- | hugolib/template_test.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/hugolib/template_test.go b/hugolib/template_test.go index de93f1c80..71b4b46c0 100644 --- a/hugolib/template_test.go +++ b/hugolib/template_test.go @@ -308,3 +308,26 @@ complex: 80: {{ partial "complex.tpl" 38 }} ) } + +func TestPartialCached(t *testing.T) { + b := newTestSitesBuilder(t) + + b.WithTemplatesAdded( + "index.html", ` +{{ $key1 := (dict "a" "av" ) }} +{{ $key2 := (dict "a" "av2" ) }} +Partial cached1: {{ partialCached "p1" "input1" $key1 }} +Partial cached2: {{ partialCached "p1" "input2" $key1 }} +Partial cached3: {{ partialCached "p1" "input3" $key2 }} +`, + "partials/p1.html", `partial: {{ . }}`, + ) + + b.Build(BuildCfg{}) + + b.AssertFileContent("public/index.html", ` + Partial cached1: partial: input1 + Partial cached2: partial: input1 + Partial cached3: partial: input3 +`) +} |