Add tests

This commit is contained in:
Alessio Treglia 2019-04-30 18:41:56 +01:00 committed by Juan Leni
parent 0bc69e7291
commit 2bd35aa49d
No known key found for this signature in database
GPG key ID: 23F1452155140419

View file

@ -1381,6 +1381,30 @@ func TestSetOutput(t *testing.T) {
}
}
func TestSetOut(t *testing.T) {
c := &Command{}
c.SetOut(nil)
if out := c.OutOrStdout(); out != os.Stdout {
t.Errorf("Expected setting output to nil to revert back to stdout")
}
}
func TestSetErr(t *testing.T) {
c := &Command{}
c.SetErr(nil)
if out := c.ErrOrStderr(); out != os.Stderr {
t.Errorf("Expected setting error to nil to revert back to stderr")
}
}
func TestSetIn(t *testing.T) {
c := &Command{}
c.SetIn(nil)
if out := c.InOrStdin(); out != os.Stdin {
t.Errorf("Expected setting input to nil to revert back to stdin")
}
}
func TestFlagErrorFunc(t *testing.T) {
c := &Command{Use: "c", Run: emptyRun}