mirror of
https://github.com/spf13/viper.git
synced 2024-04-21 12:31:38 +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:
committed by
Bjørn Erik Pedersen
parent
cc7e906d88
commit
69647fb422
+3
-5
@@ -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 {
|
||||
f.Value.Set(testValue.Value)
|
||||
f.Changed = changed
|
||||
}
|
||||
flagSet.VisitAll(func(f *pflag.Flag) {
|
||||
f.Value.Set(testValue.Value)
|
||||
f.Changed = changed
|
||||
})
|
||||
|
||||
err := v.BindPFlags(flagSet)
|
||||
|
||||
Reference in New Issue
Block a user