forked from TrueCloudLab/restic
Make TestFlags less verbose
This commit is contained in:
parent
2fa1238b8a
commit
8b461a7456
1 changed files with 2 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io/ioutil"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -13,6 +14,7 @@ func TestFlags(t *testing.T) {
|
||||||
|
|
||||||
for _, cmd := range cmdRoot.Commands() {
|
for _, cmd := range cmdRoot.Commands() {
|
||||||
t.Run(cmd.Name(), func(t *testing.T) {
|
t.Run(cmd.Name(), func(t *testing.T) {
|
||||||
|
cmd.Flags().SetOutput(ioutil.Discard)
|
||||||
err := cmd.ParseFlags([]string{"--help"})
|
err := cmd.ParseFlags([]string{"--help"})
|
||||||
if err.Error() == "pflag: help requested" {
|
if err.Error() == "pflag: help requested" {
|
||||||
err = nil
|
err = nil
|
||||||
|
|
Loading…
Add table
Reference in a new issue