MCPcopy
hub / github.com/spf13/viper / TestEnvKeyReplacer

Function TestEnvKeyReplacer

viper_test.go:727–732  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

725}
726
727func TestEnvKeyReplacer(t *testing.T) {
728 v := NewWithOptions(EnvKeyReplacer(strings.NewReplacer("-", "_")))
729 v.AutomaticEnv()
730 t.Setenv("REFRESH_INTERVAL", "30s")
731 assert.Equal(t, "30s", v.Get("refresh-interval"))
732}
733
734func TestEnvSubConfig(t *testing.T) {
735 v := New()

Callers

nothing calls this directly

Calls 4

NewWithOptionsFunction · 0.85
EnvKeyReplacerFunction · 0.85
AutomaticEnvMethod · 0.80
GetMethod · 0.65

Tested by

no test coverage detected