Fixed TestBindPFlagsStringSlice()

Replaced Visit() by VisitAll(), so that the Changed attribute of
the updated flag is correctly set.
This commit is contained in:
Benoit Masson 2017-04-17 18:52:25 +02:00 committed by Bjørn Erik Pedersen
parent cc7e906d88
commit 69647fb422

View file

@ -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)