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

Function TestParseMultiIntSliceWithDefaultsUnset

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

Source from the content-addressed store, hash-verified

2105}
2106
2107func TestParseMultiIntSliceWithDefaultsUnset(t *testing.T) {
2108 _ = (&Command{
2109 Flags: []Flag{
2110 &Int64SliceFlag{Name: "serve", Aliases: []string{"s"}, Value: []int64{9, 2}},
2111 },
2112 Action: func(_ context.Context, cmd *Command) error {
2113 expected := []int64{9, 2}
2114 assert.Equal(t, expected, cmd.Int64Slice("serve"), "main name not set")
2115 assert.Equal(t, expected, cmd.Int64Slice("s"), "short name not set")
2116 return nil
2117 },
2118 }).Run(buildTestContext(t), []string{"run"})
2119}
2120
2121func TestParseMultiIntSliceFromEnv(t *testing.T) {
2122 t.Setenv("APP_INTERVALS", "20,30,40")

Callers

nothing calls this directly

Calls 3

buildTestContextFunction · 0.85
Int64SliceMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected