Skip to content

Commit

Permalink
add for int64
Browse files Browse the repository at this point in the history
  • Loading branch information
anicoll committed Dec 9, 2020
1 parent 02f3866 commit ebe2c0e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions flag_test.go
Expand Up @@ -778,6 +778,22 @@ func TestInt64SliceFlagApply_ParentContext(t *testing.T) {
}).Run([]string{"run", "child"})
}

func TestInt64SliceFlag_SetFromParentContext(t *testing.T) {
fl := &Int64SliceFlag{Name: "numbers", Aliases: []string{"n"}, Value: NewInt64Slice(1, 2, 3, 4)}
set := flag.NewFlagSet("test", 0)
_ = fl.Apply(set)
ctx := &Context{
parentContext: &Context{
flagSet: set,
},
flagSet: flag.NewFlagSet("empty", 0),
}
expected := []int64{1, 2, 3, 4}
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
expected string
Expand Down

0 comments on commit ebe2c0e

Please sign in to comment.