(t *testing.T)
| 1953 | } |
| 1954 | |
| 1955 | func TestParseMultiStringSliceFromEnvWithDefaults(t *testing.T) { |
| 1956 | t.Setenv("APP_INTERVALS", "20,30,40") |
| 1957 | |
| 1958 | _ = (&Command{ |
| 1959 | Flags: []Flag{ |
| 1960 | &StringSliceFlag{Name: "intervals", Aliases: []string{"i"}, Value: []string{"1", "2", "5"}, Sources: EnvVars("APP_INTERVALS")}, |
| 1961 | }, |
| 1962 | Action: func(_ context.Context, cmd *Command) error { |
| 1963 | expected := []string{"20", "30", "40"} |
| 1964 | assert.Equal(t, expected, cmd.StringSlice("intervals"), "main name not set from env") |
| 1965 | assert.Equal(t, expected, cmd.StringSlice("i"), "short name not set from env") |
| 1966 | return nil |
| 1967 | }, |
| 1968 | }).Run(buildTestContext(t), []string{"run"}) |
| 1969 | } |
| 1970 | |
| 1971 | func TestParseMultiStringSliceFromEnvCascade(t *testing.T) { |
| 1972 | t.Setenv("APP_INTERVALS", "20,30,40") |
nothing calls this directly
no test coverage detected