diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-10-29 16:22:35 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-10-30 09:41:04 +0100 |
commit | 8a1c637c4494751046142e0ef345fce38fc1431b (patch) | |
tree | 43847875b05e6261ca204c3c565fc84db7f63bde /common/maps/params_test.go | |
parent | 6d95dc9d74681cba53b46e79c6e1d58d27fcdfb0 (diff) |
Fix setting HUGO_MODULE_PROXY etc. via env vars
Fixes #7903
Diffstat (limited to 'common/maps/params_test.go')
-rw-r--r-- | common/maps/params_test.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/common/maps/params_test.go b/common/maps/params_test.go index 8016a8bd6..46d672d87 100644 --- a/common/maps/params_test.go +++ b/common/maps/params_test.go @@ -47,5 +47,29 @@ func TestGetNestedParam(t *testing.T) { c.Assert(must("nested_color", "_", m), qt.Equals, "blue") c.Assert(must("nested.nestednested.color", ".", m), qt.Equals, "green") c.Assert(must("string.name", ".", m), qt.IsNil) + c.Assert(must("nested.foo", ".", m), qt.IsNil) + +} + +// https://github.com/gohugoio/hugo/issues/7903 +func TestGetNestedParamFnNestedNewKey(t *testing.T) { + + c := qt.New(t) + + nested := map[string]interface{}{ + "color": "blue", + } + m := map[string]interface{}{ + "nested": nested, + } + + existing, nestedKey, owner, err := GetNestedParamFn("nested.new", ".", func(key string) interface{} { + return m[key] + }) + + c.Assert(err, qt.IsNil) + c.Assert(existing, qt.IsNil) + c.Assert(nestedKey, qt.Equals, "new") + c.Assert(owner, qt.DeepEquals, nested) } |