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

Function TestParseMultiIntFromEnv

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

Source from the content-addressed store, hash-verified

2045}
2046
2047func TestParseMultiIntFromEnv(t *testing.T) {
2048 t.Setenv("APP_TIMEOUT_SECONDS", "10")
2049 _ = (&Command{
2050 Flags: []Flag{
2051 &Int64Flag{Name: "timeout", Aliases: []string{"t"}, Sources: EnvVars("APP_TIMEOUT_SECONDS")},
2052 },
2053 Action: func(_ context.Context, cmd *Command) error {
2054 assert.Equal(t, int64(10), cmd.Int64("timeout"), "main name not set")
2055 assert.Equal(t, int64(10), cmd.Int64("t"), "short name not set")
2056 return nil
2057 },
2058 }).Run(buildTestContext(t), []string{"run"})
2059}
2060
2061func TestParseMultiIntFromEnvCascade(t *testing.T) {
2062 t.Setenv("APP_TIMEOUT_SECONDS", "10")

Callers

nothing calls this directly

Calls 4

EnvVarsFunction · 0.85
buildTestContextFunction · 0.85
Int64Method · 0.80
RunMethod · 0.45

Tested by

no test coverage detected