diff --git a/viper_test.go b/viper_test.go index c93480e..73ff024 100644 --- a/viper_test.go +++ b/viper_test.go @@ -381,6 +381,20 @@ func TestEnv(t *testing.T) { } +func TestEmptyEnv(t *testing.T) { + initJSON() + + BindEnv("type") // Empty environment variable + BindEnv("name") // Bound, but not set environment variable + + os.Clearenv() + + os.Setenv("TYPE", "") + + assert.Equal(t, "", Get("type")) + assert.Equal(t, "Cake", Get("name")) +} + func TestEnvPrefix(t *testing.T) { initJSON()