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

Function TestIntSliceFlagApply_UsesEnvValues_withDefault

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

Source from the content-addressed store, hash-verified

1111}
1112
1113func TestIntSliceFlagApply_UsesEnvValues_withDefault(t *testing.T) {
1114 t.Setenv("MY_GOAT", "1 , 2")
1115 val := []int64{3, 4}
1116 fl := &Int64SliceFlag{Name: "goat", Sources: EnvVars("MY_GOAT"), Value: val}
1117 cmd := &Command{
1118 Flags: []Flag{
1119 fl,
1120 },
1121 }
1122 r := require.New(t)
1123 r.NoError(cmd.Run(buildTestContext(t), []string{""}))
1124 r.Equal([]int64{3, 4}, val)
1125 r.Equal([]int64{1, 2}, cmd.Value("goat"))
1126}
1127
1128func TestIntSliceFlagApply_DefaultValueWithDestination(t *testing.T) {
1129 defValue := []int64{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