mirror of https://github.com/spf13/viper.git
Add test for cannot write hidden file without extension
This commit is contained in:
parent
46a61e6fbd
commit
a1f26b11bd
|
@ -1742,6 +1742,23 @@ func TestSafeWriteConfigAsWithExistingFile(t *testing.T) {
|
|||
assert.True(t, ok, "Expected ConfigFileAlreadyExistsError")
|
||||
}
|
||||
|
||||
func TestWriteHiddenFile(t *testing.T) {
|
||||
v := New()
|
||||
fs := afero.NewMemMapFs()
|
||||
fs.Create("/test/.config")
|
||||
v.SetFs(fs)
|
||||
|
||||
v.SetConfigName(".config")
|
||||
v.SetConfigType("yaml")
|
||||
v.AddConfigPath("/test")
|
||||
|
||||
err := v.ReadInConfig()
|
||||
require.NoError(t, err)
|
||||
|
||||
err = v.WriteConfig()
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
var yamlMergeExampleTgt = []byte(`
|
||||
hello:
|
||||
pop: 37890
|
||||
|
|
Loading…
Reference in New Issue