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

Function TestParseMultiFloat64SliceFromEnv

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

Source from the content-addressed store, hash-verified

2230}
2231
2232func TestParseMultiFloat64SliceFromEnv(t *testing.T) {
2233 t.Setenv("APP_INTERVALS", "0.1,-10.5")
2234
2235 _ = (&Command{
2236 Flags: []Flag{
2237 &FloatSliceFlag{Name: "intervals", Aliases: []string{"i"}, Value: []float64{}, Sources: EnvVars("APP_INTERVALS")},
2238 },
2239 Action: func(_ context.Context, cmd *Command) error {
2240 require.Equalf(t, []float64{0.1, -10.5}, cmd.FloatSlice("intervals"), "main name not set from env")
2241 return nil
2242 },
2243 }).Run(buildTestContext(t), []string{"run"})
2244}
2245
2246func TestParseMultiFloat64SliceFromEnvCascade(t *testing.T) {
2247 t.Setenv("APP_INTERVALS", "0.1234,-10.5")

Callers

nothing calls this directly

Calls 4

EnvVarsFunction · 0.85
buildTestContextFunction · 0.85
FloatSliceMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected