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

Function TestParseMultiIntSliceFromEnvWithDefaults

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

Source from the content-addressed store, hash-verified

2137}
2138
2139func TestParseMultiIntSliceFromEnvWithDefaults(t *testing.T) {
2140 t.Setenv("APP_INTERVALS", "20,30,40")
2141
2142 _ = (&Command{
2143 Flags: []Flag{
2144 &Int64SliceFlag{Name: "intervals", Aliases: []string{"i"}, Value: []int64{1, 2, 5}, Sources: EnvVars("APP_INTERVALS")},
2145 },
2146 Action: func(_ context.Context, cmd *Command) error {
2147 r := require.New(t)
2148
2149 r.Equalf([]int64{20, 30, 40}, cmd.Int64Slice("intervals"), "main name not set from env")
2150 r.Equalf([]int64{20, 30, 40}, cmd.Int64Slice("i"), "short name not set from env")
2151 return nil
2152 },
2153 }).Run(buildTestContext(t), []string{"run"})
2154}
2155
2156func TestParseMultiIntSliceFromEnvCascade(t *testing.T) {
2157 t.Setenv("APP_INTERVALS", "20,30,40")

Callers

nothing calls this directly

Calls 4

EnvVarsFunction · 0.85
buildTestContextFunction · 0.85
Int64SliceMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected