Skip to content

Commit

Permalink
Add test for cannot write hidden file without extension
Browse files Browse the repository at this point in the history
  • Loading branch information
serazoli authored and sagikazarmark committed Sep 19, 2021
1 parent 46a61e6 commit a1f26b1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions viper_test.go
Expand Up @@ -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
Expand Down

0 comments on commit a1f26b1

Please sign in to comment.