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

Function TestCommand_Run_SubcommandFullPath

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

Source from the content-addressed store, hash-verified

2599}
2600
2601func TestCommand_Run_SubcommandFullPath(t *testing.T) {
2602 out := &bytes.Buffer{}
2603
2604 subCmd := &Command{
2605 Name: "bar",
2606 Usage: "does bar things",
2607 ArgsUsage: "[arguments...]",
2608 }
2609
2610 cmd := &Command{
2611 Name: "foo",
2612 Description: "foo commands",
2613 Commands: []*Command{subCmd},
2614 Writer: out,
2615 }
2616
2617 require.NoError(t, cmd.Run(buildTestContext(t), []string{"foo", "bar", "--help"}))
2618
2619 outString := out.String()
2620 require.Contains(t, outString, "foo bar - does bar things")
2621 require.Contains(t, outString, "foo bar [options] [arguments...]")
2622}
2623
2624func TestCommand_Run_Help(t *testing.T) {
2625 tests := []struct {

Callers

nothing calls this directly

Calls 3

RunMethod · 0.95
buildTestContextFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected