diff --git a/viper_test.go b/viper_test.go index 5596724..1e7e266 100644 --- a/viper_test.go +++ b/viper_test.go @@ -513,12 +513,17 @@ func TestMapTo(t *testing.T) { "ip": "127.0.0.1", "port": 1234, }) + SetDefault("version", "1.0.01") var service Service + var version string err := MapTo("service", &service) assert.NoError(t, err) assert.Equal(t, Get("service.port"), service.Port) assert.Equal(t, Get("service.ip"), service.IP) + err = MapTo("version", &version) + assert.NoError(t, err) + assert.Equal(t, Get("version"), version) }