(t *testing.T)
| 2137 | } |
| 2138 | |
| 2139 | func 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 | |
| 2156 | func TestParseMultiIntSliceFromEnvCascade(t *testing.T) { |
| 2157 | t.Setenv("APP_INTERVALS", "20,30,40") |
nothing calls this directly
no test coverage detected