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

Function TestCommand_CommandWithDash

command_test.go:1138–1157  ·  command_test.go::TestCommand_CommandWithDash
(t *testing.T)

Source from the content-addressed store, hash-verified

1136}
1137
1138func TestCommand_CommandWithDash(t *testing.T) {
1139 var args Args
1140
1141 cmd := &Command{
1142 Commands: []*Command{
1143 {
1144 Name: "cmd",
1145 Action: func(_ context.Context, cmd *Command) error {
1146 args = cmd.Args()
1147 return nil
1148 },
1149 },
1150 },
1151 }
1152
1153 require.NoError(t, cmd.Run(buildTestContext(t), []string{"", "cmd", "my-arg", "-"}))
1154 require.NotNil(t, args)
1155 require.Equal(t, "my-arg", args.Get(0))
1156 require.Equal(t, "-", args.Get(1))
1157}
1158
1159func TestCommand_CommandWithNoFlagBeforeTerminator(t *testing.T) {
1160 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