mirror of
https://github.com/spf13/viper
synced 2025-05-06 20:27:17 +00:00
Tests: add a test for shadowed nested key
"clothing.jacket.price" exists in defaults map, but "clothing.jacket" exists and is a value in config map => should remain undefined (“shadowed” by the config)
This commit is contained in:
parent
63a39fe605
commit
17581d7cab
1 changed files with 2 additions and 0 deletions
|
@ -918,8 +918,10 @@ func TestShadowedNestedValue(t *testing.T) {
|
||||||
polyester := "polyester"
|
polyester := "polyester"
|
||||||
initYAML()
|
initYAML()
|
||||||
SetDefault("clothing.shirt", polyester)
|
SetDefault("clothing.shirt", polyester)
|
||||||
|
SetDefault("clothing.jacket.price", 100)
|
||||||
|
|
||||||
assert.Equal(t, "leather", GetString("clothing.jacket"))
|
assert.Equal(t, "leather", GetString("clothing.jacket"))
|
||||||
|
assert.Nil(t, Get("clothing.jacket.price"))
|
||||||
assert.Equal(t, polyester, GetString("clothing.shirt"))
|
assert.Equal(t, polyester, GetString("clothing.shirt"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue