mirror of
https://github.com/spf13/viper
synced 2024-12-22 19:47:01 +00:00
Add test for cannot write hidden file without extension
This commit is contained in:
parent
46a61e6fbd
commit
a1f26b11bd
1 changed files with 17 additions and 0 deletions
|
@ -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 a new issue