reduce stdout logs in tests
Keep the stdout clean if all tests are passed. It helps to debug a broken test, because only a failed test prints to output.
This commit is contained in:
@@ -1719,6 +1719,7 @@ func TestTimestampFlagApply(t *testing.T) {
|
||||
func TestTimestampFlagApply_Fail_Parse_Wrong_Layout(t *testing.T) {
|
||||
fl := TimestampFlag{Name: "time", Aliases: []string{"t"}, Layout: "randomlayout"}
|
||||
set := flag.NewFlagSet("test", 0)
|
||||
set.SetOutput(ioutil.Discard)
|
||||
_ = fl.Apply(set)
|
||||
|
||||
err := set.Parse([]string{"--time", "2006-01-02T15:04:05Z"})
|
||||
@@ -1728,6 +1729,7 @@ func TestTimestampFlagApply_Fail_Parse_Wrong_Layout(t *testing.T) {
|
||||
func TestTimestampFlagApply_Fail_Parse_Wrong_Time(t *testing.T) {
|
||||
fl := TimestampFlag{Name: "time", Aliases: []string{"t"}, Layout: "Jan 2, 2006 at 3:04pm (MST)"}
|
||||
set := flag.NewFlagSet("test", 0)
|
||||
set.SetOutput(ioutil.Discard)
|
||||
_ = fl.Apply(set)
|
||||
|
||||
err := set.Parse([]string{"--time", "2006-01-02T15:04:05Z"})
|
||||
|
Reference in New Issue
Block a user