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

Function TestUintSliceFlagApply_UsesEnvValues_noDefault

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

Source from the content-addressed store, hash-verified

1236}
1237
1238func TestUintSliceFlagApply_UsesEnvValues_noDefault(t *testing.T) {
1239 t.Setenv("MY_GOAT", "1 , 2")
1240
1241 fl := &Uint64SliceFlag{Name: "goat", Sources: EnvVars("MY_GOAT")}
1242 cmd := &Command{
1243 Flags: []Flag{
1244 fl,
1245 },
1246 }
1247 r := require.New(t)
1248 r.NoError(cmd.Run(buildTestContext(t), []string{""}))
1249 r.Equal([]uint64{1, 2}, cmd.Value("goat"))
1250}
1251
1252func TestUintSliceFlagApply_UsesEnvValues_withDefault(t *testing.T) {
1253 t.Setenv("MY_GOAT", "1 , 2")

Callers

nothing calls this directly

Calls 4

RunMethod · 0.95
ValueMethod · 0.95
EnvVarsFunction · 0.85
buildTestContextFunction · 0.85

Tested by

no test coverage detected