MCPcopy Create free account
hub / github.com/DoNewsCode/core / TestUpgrade

Function TestUpgrade

config/config_test.go:199–210  ·  view source on GitHub ↗
(t *gotesting.T)

Source from the content-addressed store, hash-verified

197}
198
199func TestUpgrade(t *gotesting.T) {
200 var m MapAdapter = map[string]interface{}{"foo": "bar"}
201 upgraded := WithAccessor(m)
202
203 assert.Equal(t, float64(0), upgraded.Float64("foo"))
204 assert.Equal(t, 0, upgraded.Int("foo"))
205 assert.Equal(t, "bar", upgraded.String("foo"))
206 assert.Equal(t, false, upgraded.Bool("foo"))
207 assert.Equal(t, "bar", upgraded.Get("foo"))
208 assert.Equal(t, []string{"bar"}, upgraded.Strings("foo"))
209 assert.Equal(t, time.Duration(0), upgraded.Duration("foo"))
210}
211
212func prepareJSONTestSubject(t *gotesting.T) *KoanfAdapter {
213 k := koanf.New(".")

Callers

nothing calls this directly

Calls 8

WithAccessorFunction · 0.85
Float64Method · 0.65
IntMethod · 0.65
StringMethod · 0.65
BoolMethod · 0.65
GetMethod · 0.65
StringsMethod · 0.65
DurationMethod · 0.65

Tested by

no test coverage detected