mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-27 22:09:53 +02:00
Fix Params case handling in where with slices of structs (e.g. Pages)
Fixes #7009
This commit is contained in:
@@ -164,6 +164,24 @@ func TestWhere(t *testing.T) {
|
||||
{1: "a", 2: "m"},
|
||||
},
|
||||
},
|
||||
// Case insensitive maps.Params
|
||||
// Slice of structs
|
||||
{
|
||||
seq: []TstParams{{params: maps.Params{"i": 0, "color": "indigo"}}, {params: maps.Params{"i": 1, "color": "blue"}}, {params: maps.Params{"i": 2, "color": "green"}}, {params: maps.Params{"i": 3, "color": "blue"}}},
|
||||
key: ".Params.COLOR", match: "blue",
|
||||
expect: []TstParams{{params: maps.Params{"i": 1, "color": "blue"}}, {params: maps.Params{"i": 3, "color": "blue"}}},
|
||||
},
|
||||
{
|
||||
seq: []TstParams{{params: maps.Params{"nested": map[string]interface{}{"color": "indigo"}}}, {params: maps.Params{"nested": map[string]interface{}{"color": "blue"}}}},
|
||||
key: ".Params.NEsTED.COLOR", match: "blue",
|
||||
expect: []TstParams{{params: maps.Params{"nested": map[string]interface{}{"color": "blue"}}}},
|
||||
},
|
||||
{
|
||||
seq: []TstParams{{params: maps.Params{"i": 0, "color": "indigo"}}, {params: maps.Params{"i": 1, "color": "blue"}}, {params: maps.Params{"i": 2, "color": "green"}}, {params: maps.Params{"i": 3, "color": "blue"}}},
|
||||
key: ".Params", match: "blue",
|
||||
expect: []TstParams{},
|
||||
},
|
||||
// Slice of maps
|
||||
{
|
||||
seq: []maps.Params{
|
||||
{"a": "a1", "b": "b1"}, {"a": "a2", "b": "b2"},
|
||||
|
Reference in New Issue
Block a user