(t *testing.T)
| 627 | } |
| 628 | |
| 629 | func TestMultipleEnv(t *testing.T) { |
| 630 | v := New() |
| 631 | v.SetConfigType("json") |
| 632 | // Read the JSON data into Viper configuration v.config |
| 633 | require.NoError(t, v.ReadConfig(bytes.NewBuffer(jsonExample)), "Error reading json data") |
| 634 | |
| 635 | v.BindEnv("f", "FOOD", "OLD_FOOD") |
| 636 | |
| 637 | t.Setenv("OLD_FOOD", "banana") |
| 638 | |
| 639 | assert.Equal(t, "banana", v.Get("f")) |
| 640 | } |
| 641 | |
| 642 | func TestEmptyEnv(t *testing.T) { |
| 643 | v := New() |
nothing calls this directly
no test coverage detected