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

Function TestStringSliceFlagApply_UsesEnvValues_withDefault

flag_test.go:827–839  ·  flag_test.go::TestStringSliceFlagApply_UsesEnvValues_withDefault
(t *testing.T)

Source from the content-addressed store, hash-verified

825}
826
827func TestStringSliceFlagApply_UsesEnvValues_withDefault(t *testing.T) {
828 t.Setenv("MY_GOAT", "vincent van goat,scape goat")
829 val := []string{`some default`, `values here`}
830 fl := &StringSliceFlag{Name: "goat", Sources: EnvVars("MY_GOAT"), Value: val}
831 cmd := &Command{
832 Flags: []Flag{
833 fl,
834 },
835 }
836 err := cmd.Run(buildTestContext(t), []string{""})
837 assert.NoError(t, err)
838 assert.Equal(t, []string{"vincent van goat", "scape goat"}, cmd.Value("goat"))
839}
840
841func TestStringSliceFlagApply_DefaultValueWithDestination(t *testing.T) {
842 defValue := []string{"UA", "US"}

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