Skip to content

Commit

Permalink
Add slice values nil check
Browse files Browse the repository at this point in the history
  • Loading branch information
dearchap committed Oct 20, 2024
1 parent 9233b9c commit 83973f3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions flag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3030,3 +3030,10 @@ func TestExtFlag(t *testing.T) {
assert.Equal(t, "10", extF.GetDefaultText())
assert.Nil(t, extF.GetEnvVars())
}

func TestSliceValuesNil(t *testing.T) {
assert.Equal(t, []float64(nil), NewFloatSlice().Value())
assert.Equal(t, []int64(nil), NewIntSlice().Value())
assert.Equal(t, []uint64(nil), NewUintSlice().Value())
assert.Equal(t, []string(nil), NewStringSlice().Value())
}

0 comments on commit 83973f3

Please sign in to comment.