aboutsummaryrefslogtreecommitdiffhomepage
path: root/helpers/general_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2016-10-16 19:28:21 +0200
committerGitHub <[email protected]>2016-10-16 19:28:21 +0200
commit40b1b8f70373dacf2458fbd9a67be32fc6830f91 (patch)
treefb03f4cde8daecd30c5e85c989a38a9fde5a2b3c /helpers/general_test.go
parent4d6cd3cb2aa46df781adde8debf9f64d50973365 (diff)
downloadhugo-40b1b8f70373dacf2458fbd9a67be32fc6830f91.tar.gz
hugo-40b1b8f70373dacf2458fbd9a67be32fc6830f91.zip
Fix case issue Viper vs Blackfriday config
There are still work to be done in the case department, but that will have to be another day. Fixes #2581 See https://github.com/spf13/viper/issues/261
Diffstat (limited to 'helpers/general_test.go')
-rw-r--r--helpers/general_test.go53
1 files changed, 53 insertions, 0 deletions
diff --git a/helpers/general_test.go b/helpers/general_test.go
index 089bb9b1a..8afdb59eb 100644
--- a/helpers/general_test.go
+++ b/helpers/general_test.go
@@ -291,3 +291,56 @@ func TestDoArithmetic(t *testing.T) {
}
}
}
+
+func TestToLowerMap(t *testing.T) {
+
+ tests := []struct {
+ input map[string]interface{}
+ expected map[string]interface{}
+ }{
+ {
+ map[string]interface{}{
+ "abC": 32,
+ },
+ map[string]interface{}{
+ "abc": 32,
+ },
+ },
+ {
+ map[string]interface{}{
+ "abC": 32,
+ "deF": map[interface{}]interface{}{
+ 23: "A value",
+ 24: map[string]interface{}{
+ "AbCDe": "A value",
+ "eFgHi": "Another value",
+ },
+ },
+ "gHi": map[string]interface{}{
+ "J": 25,
+ },
+ },
+ map[string]interface{}{
+ "abc": 32,
+ "def": map[string]interface{}{
+ "23": "A value",
+ "24": map[string]interface{}{
+ "abcde": "A value",
+ "efghi": "Another value",
+ },
+ },
+ "ghi": map[string]interface{}{
+ "j": 25,
+ },
+ },
+ },
+ }
+
+ for i, test := range tests {
+ // ToLowerMap modifies input.
+ ToLowerMap(test.input)
+ if !reflect.DeepEqual(test.expected, test.input) {
+ t.Errorf("[%d] Expected\n%#v, got\n%#v\n", i, test.expected, test.input)
+ }
+ }
+}