@@ -234,6 +234,15 @@ func TestIntApplyInputSourceMethodSet(t *testing.T) {
234234 expect (t , 15 , c .Int ("test" ))
235235}
236236
237+ func TestIntApplyInputSourceMethodSetNegativeValue (t * testing.T ) {
238+ c := runTest (t , testApplyInputSource {
239+ Flag : NewIntFlag (& cli.IntFlag {Name : "test" }),
240+ FlagName : "test" ,
241+ MapValue : - 1 ,
242+ })
243+ expect (t , - 1 , c .Int ("test" ))
244+ }
245+
237246func TestIntApplyInputSourceMethodContextSet (t * testing.T ) {
238247 c := runTest (t , testApplyInputSource {
239248 Flag : NewIntFlag (& cli.IntFlag {Name : "test" }),
@@ -264,6 +273,15 @@ func TestDurationApplyInputSourceMethodSet(t *testing.T) {
264273 expect (t , 30 * time .Second , c .Duration ("test" ))
265274}
266275
276+ func TestDurationApplyInputSourceMethodSetNegativeValue (t * testing.T ) {
277+ c := runTest (t , testApplyInputSource {
278+ Flag : NewDurationFlag (& cli.DurationFlag {Name : "test" }),
279+ FlagName : "test" ,
280+ MapValue : - 30 * time .Second ,
281+ })
282+ expect (t , - 30 * time .Second , c .Duration ("test" ))
283+ }
284+
267285func TestDurationApplyInputSourceMethodContextSet (t * testing.T ) {
268286 c := runTest (t , testApplyInputSource {
269287 Flag : NewDurationFlag (& cli.DurationFlag {Name : "test" }),
@@ -294,6 +312,15 @@ func TestFloat64ApplyInputSourceMethodSet(t *testing.T) {
294312 expect (t , 1.3 , c .Float64 ("test" ))
295313}
296314
315+ func TestFloat64ApplyInputSourceMethodSetNegativeValue (t * testing.T ) {
316+ c := runTest (t , testApplyInputSource {
317+ Flag : NewFloat64Flag (& cli.Float64Flag {Name : "test" }),
318+ FlagName : "test" ,
319+ MapValue : - 1.3 ,
320+ })
321+ expect (t , - 1.3 , c .Float64 ("test" ))
322+ }
323+
297324func TestFloat64ApplyInputSourceMethodContextSet (t * testing.T ) {
298325 c := runTest (t , testApplyInputSource {
299326 Flag : NewFloat64Flag (& cli.Float64Flag {Name : "test" }),
0 commit comments