tpl/collections: Make delimit return a string

Closes #10876
Closes #11502
This commit is contained in:
Bjørn Erik Pedersen
2023-10-28 11:10:27 +02:00
parent 705e3cd5f5
commit e54139c85b
3 changed files with 9 additions and 16 deletions

View File

@@ -71,8 +71,7 @@ func TestAfter(t *testing.T) {
}
}
type tstGrouper struct {
}
type tstGrouper struct{}
type tstGroupers []*tstGrouper
@@ -81,8 +80,7 @@ func (g tstGrouper) Group(key any, items any) (any, error) {
return fmt.Sprintf("%v(%d)", key, ilen), nil
}
type tstGrouper2 struct {
}
type tstGrouper2 struct{}
func (g *tstGrouper2) Group(key any, items any) (any, error) {
ilen := reflect.ValueOf(items).Len()
@@ -134,7 +132,7 @@ func TestDelimit(t *testing.T) {
seq any
delimiter any
last any
expect template.HTML
expect string
}{
{[]string{"class1", "class2", "class3"}, " ", nil, "class1 class2 class3"},
{[]int{1, 2, 3, 4, 5}, ",", nil, "1,2,3,4,5"},
@@ -163,7 +161,7 @@ func TestDelimit(t *testing.T) {
} {
errMsg := qt.Commentf("[%d] %v", i, test)
var result template.HTML
var result string
var err error
if test.last == nil {