mirror of
https://github.com/spf13/viper
synced 2024-12-22 19:47:01 +00:00
adding more env tests
This commit is contained in:
parent
82cbb7dec7
commit
6c5a915341
1 changed files with 17 additions and 0 deletions
|
@ -250,6 +250,23 @@ func TestEnvPrefix(t *testing.T) {
|
||||||
assert.Equal(t, "crunk", Get("name"))
|
assert.Equal(t, "crunk", Get("name"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestAutoEnv(t *testing.T) {
|
||||||
|
Reset()
|
||||||
|
|
||||||
|
AutomaticEnv()
|
||||||
|
os.Setenv("FOO_BAR", "13")
|
||||||
|
assert.Equal(t, "13", Get("foo_bar"))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestAutoEnvWithPrefix(t *testing.T) {
|
||||||
|
Reset()
|
||||||
|
|
||||||
|
AutomaticEnv()
|
||||||
|
SetEnvPrefix("Baz")
|
||||||
|
os.Setenv("BAZ_BAR", "13")
|
||||||
|
assert.Equal(t, "13", Get("bar"))
|
||||||
|
}
|
||||||
|
|
||||||
func TestAllKeys(t *testing.T) {
|
func TestAllKeys(t *testing.T) {
|
||||||
initConfigs()
|
initConfigs()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue