mirror of
https://github.com/spf13/viper
synced 2024-12-22 19:47:01 +00:00
Fixed TestBindPFlagsStringSlice()
Replaced Visit() by VisitAll(), so that the Changed attribute of the updated flag is correctly set.
This commit is contained in:
parent
cc7e906d88
commit
69647fb422
1 changed files with 3 additions and 5 deletions
|
@ -630,11 +630,9 @@ func TestBindPFlagsStringSlice(t *testing.T) {
|
|||
|
||||
flagSet := pflag.NewFlagSet("test", pflag.ContinueOnError)
|
||||
flagSet.StringSlice("stringslice", testValue.Expected, "test")
|
||||
flagSet.Visit(func(f *pflag.Flag) {
|
||||
if len(testValue.Value) > 0 {
|
||||
flagSet.VisitAll(func(f *pflag.Flag) {
|
||||
f.Value.Set(testValue.Value)
|
||||
f.Changed = changed
|
||||
}
|
||||
})
|
||||
|
||||
err := v.BindPFlags(flagSet)
|
||||
|
|
Loading…
Reference in a new issue