Skip to content

Commit

Permalink
Add test for write hidden file without extension
Browse files Browse the repository at this point in the history
  • Loading branch information
serazoli committed Jan 15, 2021
1 parent ca3376c commit 4f6589d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions viper_test.go
Expand Up @@ -1689,6 +1689,22 @@ func TestSafeWriteConfigAsWithExistingFile(t *testing.T) {
_, ok := err.(ConfigFileAlreadyExistsError)
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:
Expand Down

0 comments on commit 4f6589d

Please sign in to comment.