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

Function TestSetupInitializesOnlyNilWriters

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

Source from the content-addressed store, hash-verified

3215}
3216
3217func TestSetupInitializesOnlyNilWriters(t *testing.T) {
3218 wr := &bytes.Buffer{}
3219 cmd := &Command{
3220 ErrWriter: wr,
3221 }
3222
3223 cmd.setupDefaults([]string{"test"})
3224
3225 assert.Equal(t, cmd.ErrWriter, wr, "expected a.ErrWriter to be a *bytes.Buffer instance")
3226 assert.Equal(t, cmd.Writer, os.Stdout, "expected a.Writer to be os.Stdout")
3227}
3228
3229// Regression for #2325. A Writer set on the root command should reach
3230// the subcommand's Action via c.Writer, not get silently replaced by

Callers

nothing calls this directly

Calls 1

setupDefaultsMethod · 0.95

Tested by

no test coverage detected