mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-22 21:42:50 +02:00
tpl: Fix reflection bug in merge
Value.Type().Key() must only be called on map values. Fixes #7899
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
56a343507c
commit
6d95dc9d74
@@ -111,6 +111,15 @@ func TestMerge(t *testing.T) {
|
||||
},
|
||||
maps.Params{"a": 1, "b": maps.Params{"d": 1, "e": 2, "f": 3}, "c": 3}, false,
|
||||
},
|
||||
{
|
||||
// https://github.com/gohugoio/hugo/issues/7899
|
||||
"matching keys with non-map src value",
|
||||
[]interface{}{
|
||||
map[string]interface{}{"k": "v"},
|
||||
map[string]interface{}{"k": map[string]interface{}{"k2": "v2"}},
|
||||
},
|
||||
map[string]interface{}{"k": map[string]interface{}{"k2": "v2"}}, false,
|
||||
},
|
||||
{"src nil", []interface{}{nil, simpleMap}, simpleMap, false},
|
||||
// Error cases.
|
||||
{"dst not a map", []interface{}{nil, "not a map"}, nil, true},
|
||||
|
Reference in New Issue
Block a user