Add test case for inverting the negation
Not sure why anyone would do this, but it's covered now.
This commit is contained in:
+6
-4
@@ -579,9 +579,6 @@ func (c *Context) getValue(value *Value) reflect.Value {
|
||||
}
|
||||
c.values[value] = v
|
||||
}
|
||||
if value.Flag != nil && value.Flag.Negated {
|
||||
v.SetBool(false)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
@@ -629,7 +626,12 @@ func (c *Context) Apply() (string, error) {
|
||||
panic("unsupported path ?!")
|
||||
}
|
||||
if value != nil {
|
||||
value.Apply(c.getValue(value))
|
||||
v := c.getValue(value)
|
||||
if value.Flag != nil && value.Flag.Negated {
|
||||
v.SetBool(!v.Bool())
|
||||
}
|
||||
|
||||
value.Apply(v)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user