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

Function TestCommand_Run

command_test.go:768–783  ·  command_test.go::TestCommand_Run
(t *testing.T)

Source from the content-addressed store, hash-verified

766}
767
768func TestCommand_Run(t *testing.T) {
769 s := ""
770
771 cmd := &Command{
772 Action: func(_ context.Context, cmd *Command) error {
773 s = s + cmd.Args().First()
774 return nil
775 },
776 }
777
778 err := cmd.Run(buildTestContext(t), []string{"command", "foo"})
779 assert.NoError(t, err)
780 err = cmd.Run(buildTestContext(t), []string{"command", "bar"})
781 assert.NoError(t, err)
782 assert.Equal(t, s, "foobar")
783}
784
785var commandTests = []struct {
786 name string

Callers

nothing calls this directly

Calls 4

ArgsMethod · 0.95
RunMethod · 0.95
buildTestContextFunction · 0.85
FirstMethod · 0.65

Tested by

no test coverage detected