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

Function TestParseMultiStringSliceFromEnvCascade

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

Source from the content-addressed store, hash-verified

1969}
1970
1971func TestParseMultiStringSliceFromEnvCascade(t *testing.T) {
1972 t.Setenv("APP_INTERVALS", "20,30,40")
1973
1974 _ = (&Command{
1975 Flags: []Flag{
1976 &StringSliceFlag{Name: "intervals", Aliases: []string{"i"}, Value: []string{}, Sources: EnvVars("COMPAT_INTERVALS", "APP_INTERVALS")},
1977 },
1978 Action: func(_ context.Context, cmd *Command) error {
1979 expected := []string{"20", "30", "40"}
1980 assert.Equal(t, expected, cmd.StringSlice("intervals"), "main name not set from env")
1981 assert.Equal(t, expected, cmd.StringSlice("i"), "short name not set from env")
1982 return nil
1983 },
1984 }).Run(buildTestContext(t), []string{"run"})
1985}
1986
1987func TestParseMultiStringSliceFromEnvCascadeWithDefaults(t *testing.T) {
1988 t.Setenv("APP_INTERVALS", "20,30,40")

Callers

nothing calls this directly

Calls 4

EnvVarsFunction · 0.85
buildTestContextFunction · 0.85
StringSliceMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected