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

Function TestParseMultiFloat64FromEnv

flag_test.go:2203–2215  ·  flag_test.go::TestParseMultiFloat64FromEnv
(t *testing.T)

Source from the content-addressed store, hash-verified

2201}
2202
2203func TestParseMultiFloat64FromEnv(t *testing.T) {
2204 t.Setenv("APP_TIMEOUT_SECONDS", "15.5")
2205 _ = (&Command{
2206 Flags: []Flag{
2207 &FloatFlag{Name: "timeout", Aliases: []string{"t"}, Sources: EnvVars("APP_TIMEOUT_SECONDS")},
2208 },
2209 Action: func(_ context.Context, cmd *Command) error {
2210 assert.Equal(t, 15.5, cmd.Float("timeout"), "main name not set")
2211 assert.Equal(t, 15.5, cmd.Float("t"), "short name not set")
2212 return nil
2213 },
2214 }).Run(buildTestContext(t), []string{"run"})
2215}
2216
2217func TestParseMultiFloat64FromEnvCascade(t *testing.T) {
2218 t.Setenv("APP_TIMEOUT_SECONDS", "15.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