test: avoid output from "go test" when tests pass

Some tests where printing to os.Stdout as a side effect even if the
output was not used/checked in the test.
main
Håvard Haugen 9 years ago
parent 0302d3914d
commit 7b94fd3aad

@ -5,6 +5,7 @@ import (
"flag"
"fmt"
"io"
"io/ioutil"
"os"
"strings"
"testing"
@ -556,6 +557,7 @@ func TestAppNoHelpFlag(t *testing.T) {
HelpFlag = BoolFlag{}
app := NewApp()
app.Writer = ioutil.Discard
err := app.Run([]string{"test", "-h"})
if err != flag.ErrHelp {

@ -3,6 +3,7 @@ package cli
import (
"errors"
"flag"
"io/ioutil"
"testing"
)
@ -20,6 +21,7 @@ func TestCommandFlagParsing(t *testing.T) {
for _, c := range cases {
app := NewApp()
app.Writer = ioutil.Discard
set := flag.NewFlagSet("test", 0)
set.Parse(c.testArgs)

Loading…
Cancel
Save