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 committed Jan 15, 2021
1 parent d10c856 commit b56493f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions viper_test.go
Expand Up @@ -1690,6 +1690,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 b56493f

Please sign in to comment.