Skip to content

Commit

Permalink
add test for nil
Browse files Browse the repository at this point in the history
  • Loading branch information
anicoll committed Jan 27, 2021
1 parent ebe2c0e commit 06e7bde
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions flag_test.go
Expand Up @@ -793,6 +793,21 @@ func TestInt64SliceFlag_SetFromParentContext(t *testing.T) {
t.Errorf("child context unable to view parent flag: %v != %v", expected, ctx.Int64Slice("numbers"))
}
}
func TestInt64SliceFlag_ReturnNil(t *testing.T) {
fl := &Int64SliceFlag{}
set := flag.NewFlagSet("test", 0)
_ = fl.Apply(set)
ctx := &Context{
parentContext: &Context{
flagSet: set,
},
flagSet: flag.NewFlagSet("empty", 0),
}
expected := []int64(nil)
if !reflect.DeepEqual(ctx.Int64Slice("numbers"), expected) {
t.Errorf("child context unable to view parent flag: %v != %v", expected, ctx.Int64Slice("numbers"))
}
}

var float64FlagTests = []struct {
name string
Expand Down

0 comments on commit 06e7bde

Please sign in to comment.