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

Function TestParseMultiIntSliceWithDefaults

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

Source from the content-addressed store, hash-verified

2089}
2090
2091func TestParseMultiIntSliceWithDefaults(t *testing.T) {
2092 _ = (&Command{
2093 Flags: []Flag{
2094 &Int64SliceFlag{Name: "serve", Aliases: []string{"s"}, Value: []int64{9, 2}},
2095 },
2096 Action: func(_ context.Context, cmd *Command) error {
2097 r := require.New(t)
2098
2099 r.Equalf([]int64{10, 20}, cmd.Int64Slice("serve"), "main name not set")
2100 r.Equalf([]int64{10, 20}, cmd.Int64Slice("s"), "short name not set")
2101
2102 return nil
2103 },
2104 }).Run(buildTestContext(t), []string{"run", "-s", "10", "-s", "20"})
2105}
2106
2107func TestParseMultiIntSliceWithDefaultsUnset(t *testing.T) {
2108 _ = (&Command{

Callers

nothing calls this directly

Calls 3

buildTestContextFunction · 0.85
Int64SliceMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected