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

Function TestIntSliceFlagApply_UsesEnvValues_noDefault

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

Source from the content-addressed store, hash-verified

1096}
1097
1098func TestIntSliceFlagApply_UsesEnvValues_noDefault(t *testing.T) {
1099 t.Setenv("MY_GOAT", "1 , 2")
1100
1101 fl := &Int64SliceFlag{Name: "goat", Sources: EnvVars("MY_GOAT")}
1102 cmd := &Command{
1103 Flags: []Flag{
1104 fl,
1105 },
1106 }
1107 r := require.New(t)
1108 r.NoError(cmd.Run(buildTestContext(t), []string{""}))
1109 r.NoError(fl.PostParse())
1110 r.Equal([]int64{1, 2}, cmd.Value("goat"))
1111}
1112
1113func TestIntSliceFlagApply_UsesEnvValues_withDefault(t *testing.T) {
1114 t.Setenv("MY_GOAT", "1 , 2")

Callers

nothing calls this directly

Calls 5

RunMethod · 0.95
ValueMethod · 0.95
EnvVarsFunction · 0.85
buildTestContextFunction · 0.85
PostParseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…