Skip to content

Commit

Permalink
Add test when flag is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
dearchap committed Apr 24, 2022
1 parent 7f37d1d commit d198aed
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions altsrc/flag_test.go
Expand Up @@ -321,6 +321,15 @@ func TestFloat64ApplyInputSourceMethodSetNegativeValue(t *testing.T) {
expect(t, -1.3, c.Float64("test"))
}

func TestFloat64ApplyInputSourceMethodSetNegativeValueNotSet(t *testing.T) {
c := runTest(t, testApplyInputSource{
Flag: NewFloat64Flag(&cli.Float64Flag{Name: "test1"}),
FlagName: "test1",
// dont set map value
})
expect(t, 0.0, c.Float64("test1"))
}

func TestFloat64ApplyInputSourceMethodContextSet(t *testing.T) {
c := runTest(t, testApplyInputSource{
Flag: NewFloat64Flag(&cli.Float64Flag{Name: "test"}),
Expand Down

0 comments on commit d198aed

Please sign in to comment.