From 6c5a915341f6d411a84ac2ee5a99569c2bc4b7f4 Mon Sep 17 00:00:00 2001 From: spf13 Date: Mon, 16 Feb 2015 23:32:10 -0500 Subject: [PATCH] adding more env tests --- viper_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/viper_test.go b/viper_test.go index ce1aa3c..92e62cc 100644 --- a/viper_test.go +++ b/viper_test.go @@ -250,6 +250,23 @@ func TestEnvPrefix(t *testing.T) { 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) { initConfigs()