add for int64
This commit is contained in:
parent
02f3866db2
commit
ebe2c0ea70
16
flag_test.go
16
flag_test.go
@ -778,6 +778,22 @@ func TestInt64SliceFlagApply_ParentContext(t *testing.T) {
|
|||||||
}).Run([]string{"run", "child"})
|
}).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 {
|
var float64FlagTests = []struct {
|
||||||
name string
|
name string
|
||||||
expected string
|
expected string
|
||||||
|
Loading…
Reference in New Issue
Block a user