Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dearchap committed Jan 22, 2023
1 parent eadd22c commit 9d56eb7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions altsrc/flag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,18 @@ func TestInt64SliceFlagApplyInputSourceValue(t *testing.T) {
refute(t, dest.Value(), []int64{1, 2})
}

func TestInt64SliceFlagApplyInputSourceValueNotSet(t *testing.T) {
dest := cli.NewInt64Slice()
tis := testApplyInputSource{
Flag: NewInt64SliceFlag(&cli.Int64SliceFlag{Name: "test", Destination: dest}),
FlagName: "test1",
MapValue: []interface{}{int64(1), int64(2)},
}
c := runTest(t, tis)
expect(t, c.Int64Slice("test"), []int64{})
expect(t, dest.Value(), []int64{})
}

func TestFloat64SliceFlagApplyInputSourceValue(t *testing.T) {
dest := cli.NewFloat64Slice()
tis := testApplyInputSource{
Expand All @@ -303,6 +315,18 @@ func TestFloat64SliceFlagApplyInputSourceValue(t *testing.T) {
refute(t, dest.Value(), []int64{1, 2})
}

func TestFloat64SliceFlagApplyInputSourceValueNotSet(t *testing.T) {
dest := cli.NewFloat64Slice()
tis := testApplyInputSource{
Flag: NewFloat64SliceFlag(&cli.Float64SliceFlag{Name: "test", Destination: dest}),
FlagName: "test1",
MapValue: []interface{}{float64(1.0), float64(2.1)},
}
c := runTest(t, tis)
expect(t, c.Float64Slice("test"), []float64{})
expect(t, dest.Value(), []float64{})
}

func TestBoolApplyInputSourceMethodSet(t *testing.T) {
tis := testApplyInputSource{
Flag: NewBoolFlag(&cli.BoolFlag{Name: "test"}),
Expand Down

0 comments on commit 9d56eb7

Please sign in to comment.