(t *testing.T)
| 640 | } |
| 641 | |
| 642 | func TestEmptyEnv(t *testing.T) { |
| 643 | v := New() |
| 644 | v.SetConfigType("json") |
| 645 | // Read the JSON data into Viper configuration v.config |
| 646 | require.NoError(t, v.ReadConfig(bytes.NewBuffer(jsonExample)), "Error reading json data") |
| 647 | |
| 648 | v.BindEnv("type") // Empty environment variable |
| 649 | v.BindEnv("name") // Bound, but not set environment variable |
| 650 | |
| 651 | t.Setenv("TYPE", "") |
| 652 | |
| 653 | assert.Equal(t, "donut", v.Get("type")) |
| 654 | assert.Equal(t, "Cake", v.Get("name")) |
| 655 | } |
| 656 | |
| 657 | func TestEmptyEnv_Allowed(t *testing.T) { |
| 658 | v := New() |
nothing calls this directly
no test coverage detected