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

Function TestGenericFlagValueFromCommand

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

Source from the content-addressed store, hash-verified

1691}
1692
1693func TestGenericFlagValueFromCommand(t *testing.T) {
1694 cmd := &Command{
1695 Name: "foo",
1696 Flags: []Flag{
1697 &GenericFlag{Name: "myflag", Value: &Parser{}},
1698 },
1699 }
1700
1701 assert.NoError(t, cmd.Run(buildTestContext(t), []string{"foo", "--myflag", "abc,def"}))
1702 assert.Equal(t, &Parser{"abc", "def"}, cmd.Generic("myflag"))
1703 assert.Nil(t, cmd.Generic("someother"))
1704}
1705
1706func TestParseGenericFromEnv(t *testing.T) {
1707 t.Setenv("APP_SERVE", "20,30")

Callers

nothing calls this directly

Calls 3

RunMethod · 0.95
GenericMethod · 0.95
buildTestContextFunction · 0.85

Tested by

no test coverage detected