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

Function TestWrongDirsSearchNotFound

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

Source from the content-addressed store, hash-verified

1642}
1643
1644func TestWrongDirsSearchNotFound(t *testing.T) {
1645 _, config := initDirs(t)
1646
1647 v := New()
1648 v.SetConfigName(config)
1649 v.SetDefault(`key`, `default`)
1650
1651 v.AddConfigPath(`whattayoutalkingbout`)
1652 v.AddConfigPath(`thispathaintthere`)
1653
1654 err := v.ReadInConfig()
1655 assert.IsType(t, ConfigFileNotFoundError{"", ""}, err)
1656
1657 // Even though config did not load and the error might have
1658 // been ignored by the client, the default still loads
1659 assert.Equal(t, `default`, v.GetString(`key`))
1660}
1661
1662func TestWrongDirsSearchNotFoundForMerge(t *testing.T) {
1663 _, config := initDirs(t)

Callers

nothing calls this directly

Calls 7

initDirsFunction · 0.85
NewFunction · 0.85
SetConfigNameMethod · 0.80
SetDefaultMethod · 0.80
AddConfigPathMethod · 0.80
ReadInConfigMethod · 0.80
GetStringMethod · 0.80

Tested by

no test coverage detected