diff options
| author | Alex Ogier <[email protected]> | 2012-12-19 04:48:58 -0500 |
|---|---|---|
| committer | Alex Ogier <[email protected]> | 2012-12-19 04:48:58 -0500 |
| commit | fc678a46fb7fcef2879c7361da75cd77ec172444 (patch) | |
| tree | 0cd72a992436f3634582b94aac5dafc8510befdb | |
| parent | b7e64714a53ad4b5ee9f656aad2f61e358623d11 (diff) | |
Squelch internal error messages while testing
| -rw-r--r-- | export_test.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/export_test.go b/export_test.go index 8ff8e29..8c74635 100644 --- a/export_test.go +++ b/export_test.go @@ -4,7 +4,10 @@ package pflag -import "os" +import ( + "io/ioutil" + "os" +) // Additional routines compiled into the package only during testing. @@ -12,7 +15,11 @@ import "os" // After calling ResetForTesting, parse errors in flag handling will not // exit the program. func ResetForTesting(usage func()) { - commandLine = NewFlagSet(os.Args[0], ContinueOnError) + commandLine = &FlagSet{ + name: os.Args[0], + errorHandling: ContinueOnError, + output: ioutil.Discard, + } Usage = usage } |
