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

Function TestUnmarshalExact

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

Source from the content-addressed store, hash-verified

498}
499
500func TestUnmarshalExact(t *testing.T) {
501 v := New()
502 target := &testUnmarshalExtra{}
503 v.SetConfigType("yaml")
504 r := bytes.NewReader(yamlExampleWithExtras)
505 v.ReadConfig(r)
506 err := v.UnmarshalExact(target)
507 assert.Error(t, err, "UnmarshalExact should error when populating a struct from a conf that contains unused fields")
508}
509
510func TestOverrides(t *testing.T) {
511 v := New()

Callers

nothing calls this directly

Calls 5

NewFunction · 0.85
SetConfigTypeMethod · 0.80
ReadConfigMethod · 0.80
UnmarshalExactMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected