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

Function TestParseMultiFloat64FromEnvCascade

flag_test.go:2217–2230  ·  flag_test.go::TestParseMultiFloat64FromEnvCascade
(t *testing.T)

Source from the content-addressed store, hash-verified

2215}
2216
2217func TestParseMultiFloat64FromEnvCascade(t *testing.T) {
2218 t.Setenv("APP_TIMEOUT_SECONDS", "15.5")
2219
2220 _ = (&Command{
2221 Flags: []Flag{
2222 &FloatFlag{Name: "timeout", Aliases: []string{"t"}, Sources: EnvVars("COMPAT_TIMEOUT_SECONDS", "APP_TIMEOUT_SECONDS")},
2223 },
2224 Action: func(_ context.Context, cmd *Command) error {
2225 assert.Equal(t, 15.5, cmd.Float("timeout"), "main name not set")
2226 assert.Equal(t, 15.5, cmd.Float("t"), "short name not set")
2227 return nil
2228 },
2229 }).Run(buildTestContext(t), []string{"run"})
2230}
2231
2232func TestParseMultiFloat64SliceFromEnv(t *testing.T) {
2233 t.Setenv("APP_INTERVALS", "0.1,-10.5")

Callers

nothing calls this directly

Calls 4

EnvVarsFunction · 0.85
buildTestContextFunction · 0.85
FloatMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected