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.
This commit is contained in:
Håvard Haugen
2015-11-28 18:26:10 +01:00
parent 0302d3914d
commit 7b94fd3aad
2 changed files with 4 additions and 0 deletions

View File

@@ -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 {