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

Function TestCommand_SkipFlagParsing

command_test.go:1181–1198  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1179}
1180
1181func TestCommand_SkipFlagParsing(t *testing.T) {
1182 var args Args
1183
1184 cmd := &Command{
1185 SkipFlagParsing: true,
1186 Action: func(_ context.Context, cmd *Command) error {
1187 args = cmd.Args()
1188 return nil
1189 },
1190 }
1191
1192 _ = cmd.Run(buildTestContext(t), []string{"", "--", "my-arg", "notAFlagAtAll"})
1193
1194 assert.NotNil(t, args)
1195 assert.Equal(t, "--", args.Get(0))
1196 assert.Equal(t, "my-arg", args.Get(1))
1197 assert.Equal(t, "notAFlagAtAll", args.Get(2))
1198}
1199
1200func TestCommand_VisibleCommands(t *testing.T) {
1201 cmd := &Command{

Callers

nothing calls this directly

Calls 4

ArgsMethod · 0.95
RunMethod · 0.95
GetMethod · 0.95
buildTestContextFunction · 0.85

Tested by

no test coverage detected