summaryrefslogtreecommitdiffstats
path: root/common/maps/maps_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-11-21 21:59:38 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-11-22 18:41:50 +0100
commita3fe5e5e35f311f22b6b4fc38abfcf64cd2c7d6f (patch)
tree06cf1f647ae026b4fb3053c85370c2b203c7a089 /common/maps/maps_test.go
parentcd07e6d57b158a76f812e8c4c9567dbc84f57939 (diff)
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" }} ```
Diffstat (limited to 'common/maps/maps_test.go')
-rw-r--r--common/maps/maps_test.go24
1 files changed, 13 insertions, 11 deletions
diff --git a/common/maps/maps_test.go b/common/maps/maps_test.go
index 8b0aa5eb9..6e4947adb 100644
--- a/common/maps/maps_test.go
+++ b/common/maps/maps_test.go
@@ -14,6 +14,7 @@
package maps
import (
+ "fmt"
"reflect"
"testing"
@@ -21,7 +22,6 @@ import (
)
func TestToLower(t *testing.T) {
-
tests := []struct {
input map[string]interface{}
expected map[string]interface{}
@@ -30,7 +30,7 @@ func TestToLower(t *testing.T) {
map[string]interface{}{
"abC": 32,
},
- map[string]interface{}{
+ Params{
"abc": 32,
},
},
@@ -48,16 +48,16 @@ func TestToLower(t *testing.T) {
"J": 25,
},
},
- map[string]interface{}{
+ Params{
"abc": 32,
- "def": map[string]interface{}{
+ "def": Params{
"23": "A value",
- "24": map[string]interface{}{
+ "24": Params{
"abcde": "A value",
"efghi": "Another value",
},
},
- "ghi": map[string]interface{}{
+ "ghi": Params{
"j": 25,
},
},
@@ -65,11 +65,13 @@ func TestToLower(t *testing.T) {
}
for i, test := range tests {
- // ToLower modifies input.
- ToLower(test.input)
- if !reflect.DeepEqual(test.expected, test.input) {
- t.Errorf("[%d] Expected\n%#v, got\n%#v\n", i, test.expected, test.input)
- }
+ t.Run(fmt.Sprint(i), func(t *testing.T) {
+ // ToLower modifies input.
+ ToLower(test.input)
+ if !reflect.DeepEqual(test.expected, test.input) {
+ t.Errorf("[%d] Expected\n%#v, got\n%#v\n", i, test.expected, test.input)
+ }
+ })
}
}