mirror of
https://github.com/spf13/viper
synced 2025-05-07 12:47:18 +00:00
Add test case for empty environment variable
This commit is contained in:
parent
dc3e53cb8b
commit
5874d0cb08
1 changed files with 14 additions and 0 deletions
|
@ -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) {
|
func TestEnvPrefix(t *testing.T) {
|
||||||
initJSON()
|
initJSON()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue