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

Function TestMergeConfigNoMerge

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

Source from the content-addressed store, hash-verified

2112}
2113
2114func TestMergeConfigNoMerge(t *testing.T) {
2115 v := New()
2116 v.SetConfigType("yml")
2117 err := v.ReadConfig(bytes.NewBuffer(yamlMergeExampleTgt))
2118 require.NoError(t, err)
2119
2120 assert.Equal(t, 37890, v.GetInt("hello.pop"))
2121 assert.Len(t, v.GetStringSlice("hello.world"), 4)
2122 assert.Empty(t, v.GetString("fu"))
2123
2124 err = v.ReadConfig(bytes.NewBuffer(yamlMergeExampleSrc))
2125 require.NoError(t, err)
2126
2127 assert.Equal(t, 45000, v.GetInt("hello.pop"))
2128 assert.Empty(t, v.GetStringSlice("hello.world"))
2129 assert.Len(t, v.GetStringSlice("hello.universe"), 2)
2130 assert.Len(t, v.GetIntSlice("hello.ints"), 2)
2131 assert.Equal(t, "bar", v.GetString("fu"))
2132}
2133
2134func TestMergeConfigMap(t *testing.T) {
2135 v := New()

Callers

nothing calls this directly

Calls 7

NewFunction · 0.85
SetConfigTypeMethod · 0.80
ReadConfigMethod · 0.80
GetIntMethod · 0.80
GetStringSliceMethod · 0.80
GetStringMethod · 0.80
GetIntSliceMethod · 0.80

Tested by

no test coverage detected