MCPcopy
hub / github.com/urfave/cli / TestIntSliceFlagApply_ParentContext

Function TestIntSliceFlagApply_ParentContext

flag_test.go:1143–1159  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1141}
1142
1143func TestIntSliceFlagApply_ParentContext(t *testing.T) {
1144 _ = (&Command{
1145 Flags: []Flag{
1146 &Int64SliceFlag{Name: "numbers", Aliases: []string{"n"}, Value: []int64{1, 2, 3}},
1147 },
1148 Commands: []*Command{
1149 {
1150 Name: "child",
1151 Action: func(_ context.Context, cmd *Command) error {
1152 require.Equalf(t, []int64{1, 2, 3}, cmd.Int64Slice("numbers"), "child context unable to view parent flag")
1153
1154 return nil
1155 },
1156 },
1157 },
1158 }).Run(buildTestContext(t), []string{"run", "child"})
1159}
1160
1161func TestIntSliceFlag_SetFromParentCommand(t *testing.T) {
1162 fl := &Int64SliceFlag{Name: "numbers", Aliases: []string{"n"}, Value: []int64{1, 2, 3, 4}}

Callers

nothing calls this directly

Calls 3

buildTestContextFunction · 0.85
Int64SliceMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected