mirror of https://github.com/spf13/viper.git
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
|
@ -630,11 +630,9 @@ func TestBindPFlagsStringSlice(t *testing.T) {
|
||||||
|
|
||||||
flagSet := pflag.NewFlagSet("test", pflag.ContinueOnError)
|
flagSet := pflag.NewFlagSet("test", pflag.ContinueOnError)
|
||||||
flagSet.StringSlice("stringslice", testValue.Expected, "test")
|
flagSet.StringSlice("stringslice", testValue.Expected, "test")
|
||||||
flagSet.Visit(func(f *pflag.Flag) {
|
flagSet.VisitAll(func(f *pflag.Flag) {
|
||||||
if len(testValue.Value) > 0 {
|
f.Value.Set(testValue.Value)
|
||||||
f.Value.Set(testValue.Value)
|
f.Changed = changed
|
||||||
f.Changed = changed
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
err := v.BindPFlags(flagSet)
|
err := v.BindPFlags(flagSet)
|
||||||
|
|
Loading…
Reference in New Issue