mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-27 22:09:53 +02:00
@@ -40,10 +40,10 @@ func TestSort(t *testing.T) {
|
||||
}
|
||||
|
||||
for i, test := range []struct {
|
||||
seq interface{}
|
||||
sortByField interface{}
|
||||
seq any
|
||||
sortByField any
|
||||
sortAsc string
|
||||
expect interface{}
|
||||
expect any
|
||||
}{
|
||||
{[]string{"class1", "class2", "class3"}, nil, "asc", []string{"class1", "class2", "class3"}},
|
||||
{[]string{"class3", "class1", "class2"}, nil, "asc", []string{"class1", "class2", "class3"}},
|
||||
@@ -205,17 +205,17 @@ func TestSort(t *testing.T) {
|
||||
},
|
||||
// interface slice with missing elements
|
||||
{
|
||||
[]interface{}{
|
||||
map[interface{}]interface{}{"Title": "Foo", "Weight": 10},
|
||||
map[interface{}]interface{}{"Title": "Bar"},
|
||||
map[interface{}]interface{}{"Title": "Zap", "Weight": 5},
|
||||
[]any{
|
||||
map[any]any{"Title": "Foo", "Weight": 10},
|
||||
map[any]any{"Title": "Bar"},
|
||||
map[any]any{"Title": "Zap", "Weight": 5},
|
||||
},
|
||||
"Weight",
|
||||
"asc",
|
||||
[]interface{}{
|
||||
map[interface{}]interface{}{"Title": "Bar"},
|
||||
map[interface{}]interface{}{"Title": "Zap", "Weight": 5},
|
||||
map[interface{}]interface{}{"Title": "Foo", "Weight": 10},
|
||||
[]any{
|
||||
map[any]any{"Title": "Bar"},
|
||||
map[any]any{"Title": "Zap", "Weight": 5},
|
||||
map[any]any{"Title": "Foo", "Weight": 10},
|
||||
},
|
||||
},
|
||||
// test boolean values
|
||||
@@ -239,7 +239,7 @@ func TestSort(t *testing.T) {
|
||||
{nil, nil, "asc", false},
|
||||
} {
|
||||
t.Run(fmt.Sprintf("test%d", i), func(t *testing.T) {
|
||||
var result interface{}
|
||||
var result any
|
||||
var err error
|
||||
if test.sortByField == nil {
|
||||
result, err = ns.Sort(test.seq)
|
||||
|
Reference in New Issue
Block a user