Skip to content
Myr

Added test for (fixed) bug in upstream library pflag

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by spf13 · committed by spf13 · parent 7216b06 · Browse files · 1 file+14 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+14 added−0 removed

  • other:+14 added−0 removed

1 file+14 added−0 removed

modified:cobra_test.go+14 added
255 unmodified lines
256 t.Errorf("Wrong error message displayed, \n %s", buf.String())257 }258}259260func TestTrailingCommandFlags(t *testing.T) {261 buf := new(bytes.Buffer)262 c := initialize()263 c.SetOutput(buf)264 cmdEcho.AddCommand(cmdTimes)265 c.AddCommand(cmdPrint, cmdEcho)266 c.SetArgs(strings.Split("echo two -x", " "))267 e3 := c.Execute()268269 if e3 == nil {270 t.Errorf("invalid flag should generate error")271 }272}273274func TestPersistentFlags(t *testing.T) {275 c := initialize()276 cmdEcho.AddCommand(cmdTimes)277 c.AddCommand(cmdPrint, cmdEcho)
84 unmodified lines