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

Function TestUintSliceFlagApply_UsesEnvValues_withDefault

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

Source from the content-addressed store, hash-verified

1250}
1251
1252func TestUintSliceFlagApply_UsesEnvValues_withDefault(t *testing.T) {
1253 t.Setenv("MY_GOAT", "1 , 2")
1254 val := NewUint64Slice(3, 4)
1255 fl := &Uint64SliceFlag{Name: "goat", Sources: EnvVars("MY_GOAT"), Value: val.Value()}
1256 cmd := &Command{
1257 Flags: []Flag{
1258 fl,
1259 },
1260 }
1261 r := require.New(t)
1262 r.NoError(cmd.Run(buildTestContext(t), []string{""}))
1263 r.Equal([]uint64{3, 4}, val.Value())
1264 r.Equal([]uint64{1, 2}, cmd.Value("goat"))
1265}
1266
1267func TestUintSliceFlagApply_DefaultValueWithDestination(t *testing.T) {
1268 defValue := []uint64{1, 2}

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected