summaryrefslogtreecommitdiffstats
path: root/tpl/collections
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-06-14 09:00:28 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-06-14 20:18:54 +0200
commitd178fe94fe26ce2cf8096f330f3d160af3ec818d (patch)
treeb65e8931a62ad3854a2444c5817a7926b0a45577 /tpl/collections
parent732dcb848f6455ad8f1d5ec2351257015c87eec7 (diff)
tpl/collections: Fix append when appending a slice to a slice of slices
Fixes #11093
Diffstat (limited to 'tpl/collections')
-rw-r--r--tpl/collections/integration_test.go31
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]]")
+
+ }
+
+}