mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-28 22:19:59 +02:00
tpl/collections: Fix append when appending a slice to a slice of slices
Fixes #11093
This commit is contained in:
@@ -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]]")
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user