Fix Params case handling in the index, sort and where func

This means that you can now do:

```
{{ range where .Site.Pages "Params.MYPARAM" "foo" }}
```
This commit is contained in:
Bjørn Erik Pedersen
2019-11-21 21:59:38 +01:00
parent cd07e6d57b
commit a3fe5e5e35
33 changed files with 317 additions and 155 deletions

View File

@@ -17,6 +17,8 @@ import (
"fmt"
"testing"
"github.com/gohugoio/hugo/common/maps"
qt "github.com/frankban/quicktest"
"github.com/gohugoio/hugo/deps"
)
@@ -42,7 +44,8 @@ func TestIndex(t *testing.T) {
{[]map[string]map[string]string{{"a": {"b": "c"}}}, []interface{}{0, "a", "b"}, "c", false},
{map[string]map[string]interface{}{"a": {"b": []string{"c", "d"}}}, []interface{}{"a", "b", 1}, "d", false},
{map[string]map[string]string{"a": {"b": "c"}}, []interface{}{[]string{"a", "b"}}, "c", false},
{maps.Params{"a": "av"}, []interface{}{"A"}, "av", false},
{maps.Params{"a": map[string]interface{}{"b": "bv"}}, []interface{}{"A", "B"}, "bv", false},
// errors
{nil, nil, nil, true},
{[]int{0, 1}, []interface{}{"1"}, nil, true},