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

Function TestCommand_CommandWithNoFlagBeforeTerminator

command_test.go:1159–1179  ·  command_test.go::TestCommand_CommandWithNoFlagBeforeTerminator
(t *testing.T)

Source from the content-addressed store, hash-verified

1157}
1158
1159func TestCommand_CommandWithNoFlagBeforeTerminator(t *testing.T) {
1160 var args Args
1161
1162 cmd := &Command{
1163 Commands: []*Command{
1164 {
1165 Name: "cmd",
1166 Action: func(_ context.Context, cmd *Command) error {
1167 args = cmd.Args()
1168 return nil
1169 },
1170 },
1171 },
1172 }
1173
1174 require.NoError(t, cmd.Run(buildTestContext(t), []string{"", "cmd", "my-arg", "--", "notAFlagAtAll"}))
1175
1176 require.NotNil(t, args)
1177 require.Equal(t, "my-arg", args.Get(0))
1178 require.Equal(t, "notAFlagAtAll", args.Get(1))
1179}
1180
1181func TestCommand_SkipFlagParsing(t *testing.T) {
1182 var args Args

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