diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-06-14 09:00:28 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-06-14 20:18:54 +0200 |
commit | d178fe94fe26ce2cf8096f330f3d160af3ec818d (patch) | |
tree | b65e8931a62ad3854a2444c5817a7926b0a45577 /tpl | |
parent | 732dcb848f6455ad8f1d5ec2351257015c87eec7 (diff) |
tpl/collections: Fix append when appending a slice to a slice of slices
Fixes #11093
Diffstat (limited to 'tpl')
-rw-r--r-- | tpl/collections/integration_test.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tpl/collections/integration_test.go b/tpl/collections/integration_test.go index 225eab9fa..da1d6e488 100644 --- a/tpl/collections/integration_test.go +++ b/tpl/collections/integration_test.go @@ -73,3 +73,34 @@ Desc: [map[a:3 b:3] map[a:3 b:1] map[a:3 b:1] map[a:3 b:1] map[a:3 b:0] map[a:3 } } + +// Issue #11004. +func TestAppendSliceToASliceOfSlices(t *testing.T) { + t.Parallel() + + files := ` +-- hugo.toml -- +-- layouts/index.html -- +{{ $obj := slice (slice "a") }} +{{ $obj = $obj | append (slice "b") }} +{{ $obj = $obj | append (slice "c") }} + +{{ $obj }} + + + ` + + for i := 0; i < 4; i++ { + + b := hugolib.NewIntegrationTestBuilder( + hugolib.IntegrationTestConfig{ + T: t, + TxtarString: files, + }, + ).Build() + + b.AssertFileContent("public/index.html", "[[a] [b] [c]]") + + } + +} |