github.com/fighterlyt/hugo@v0.47.1/common/maps/maps_test.go (about) 1 // Copyright 2018 The Hugo Authors. All rights reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // http://www.apache.org/licenses/LICENSE-2.0 7 // 8 // Unless required by applicable law or agreed to in writing, software 9 // distributed under the License is distributed on an "AS IS" BASIS, 10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // See the License for the specific language governing permissions and 12 // limitations under the License. 13 14 package maps 15 16 import ( 17 "reflect" 18 "testing" 19 ) 20 21 func TestToLower(t *testing.T) { 22 23 tests := []struct { 24 input map[string]interface{} 25 expected map[string]interface{} 26 }{ 27 { 28 map[string]interface{}{ 29 "abC": 32, 30 }, 31 map[string]interface{}{ 32 "abc": 32, 33 }, 34 }, 35 { 36 map[string]interface{}{ 37 "abC": 32, 38 "deF": map[interface{}]interface{}{ 39 23: "A value", 40 24: map[string]interface{}{ 41 "AbCDe": "A value", 42 "eFgHi": "Another value", 43 }, 44 }, 45 "gHi": map[string]interface{}{ 46 "J": 25, 47 }, 48 }, 49 map[string]interface{}{ 50 "abc": 32, 51 "def": map[string]interface{}{ 52 "23": "A value", 53 "24": map[string]interface{}{ 54 "abcde": "A value", 55 "efghi": "Another value", 56 }, 57 }, 58 "ghi": map[string]interface{}{ 59 "j": 25, 60 }, 61 }, 62 }, 63 } 64 65 for i, test := range tests { 66 // ToLower modifies input. 67 ToLower(test.input) 68 if !reflect.DeepEqual(test.expected, test.input) { 69 t.Errorf("[%d] Expected\n%#v, got\n%#v\n", i, test.expected, test.input) 70 } 71 } 72 }