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

Function TestCommand_Run_SubcommandsCanUseErrWriter

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

Source from the content-addressed store, hash-verified

541}
542
543func TestCommand_Run_SubcommandsCanUseErrWriter(t *testing.T) {
544 cmd := &Command{
545 ErrWriter: io.Discard,
546 Name: "bar",
547 Usage: "this is for testing",
548 Commands: []*Command{
549 {
550 Name: "baz",
551 Usage: "this is for testing",
552 Action: func(_ context.Context, cmd *Command) error {
553 require.Equal(t, io.Discard, cmd.Root().ErrWriter)
554
555 return nil
556 },
557 },
558 },
559 }
560
561 require.NoError(t, cmd.Run(buildTestContext(t), []string{"bar", "baz"}))
562}
563
564func TestCommandSkipFlagParsing(t *testing.T) {
565 cases := []struct {

Callers

nothing calls this directly

Calls 3

RootMethod · 0.95
RunMethod · 0.95
buildTestContextFunction · 0.85

Tested by

no test coverage detected