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

Function TestStringSliceFlagApply_UsesEnvValues_noDefault

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

Source from the content-addressed store, hash-verified

811}
812
813func TestStringSliceFlagApply_UsesEnvValues_noDefault(t *testing.T) {
814 t.Setenv("MY_GOAT", "vincent van goat,scape goat")
815 fl := &StringSliceFlag{Name: "goat", Sources: EnvVars("MY_GOAT")}
816 cmd := &Command{
817 Flags: []Flag{
818 fl,
819 },
820 }
821
822 err := cmd.Run(buildTestContext(t), []string{""})
823 assert.NoError(t, err)
824 assert.Equal(t, []string{"vincent van goat", "scape goat"}, cmd.Value("goat"))
825}
826
827func TestStringSliceFlagApply_UsesEnvValues_withDefault(t *testing.T) {
828 t.Setenv("MY_GOAT", "vincent van goat,scape goat")

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