From 969535eec606fc699db382e4e28221ff11c653d5 Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Sat, 7 Dec 2019 12:15:17 +0530 Subject: [PATCH] replace log.Print with t.Log --- app_test.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app_test.go b/app_test.go index 7a02d65..53e78b7 100644 --- a/app_test.go +++ b/app_test.go @@ -7,7 +7,6 @@ import ( "fmt" "io" "io/ioutil" - "log" "os" "reflect" "strings" @@ -1423,7 +1422,7 @@ func TestApp_Run_CommandWithSubcommandHasHelpTopic(t *testing.T) { } for _, flagSet := range subcommandHelpTopics { - log.Printf("==> checking with flags %v", flagSet) + t.Logf("==> checking with flags %v", flagSet) app := &App{} buf := new(bytes.Buffer) @@ -1613,7 +1612,7 @@ func TestApp_Run_Help(t *testing.T) { for _, args := range helpArguments { buf := new(bytes.Buffer) - log.Printf("==> checking with arguments %v", args) + t.Logf("==> checking with arguments %v", args) app := &App{ Name: "boom", @@ -1631,7 +1630,7 @@ func TestApp_Run_Help(t *testing.T) { } output := buf.String() - log.Printf("output: %q\n", buf.Bytes()) + t.Logf("output: %q\n", buf.Bytes()) if !strings.Contains(output, "boom - make an explosive entrance") { t.Errorf("want help to contain %q, did not: \n%q", "boom - make an explosive entrance", output) @@ -1645,7 +1644,7 @@ func TestApp_Run_Version(t *testing.T) { for _, args := range versionArguments { buf := new(bytes.Buffer) - log.Printf("==> checking with arguments %v", args) + t.Logf("==> checking with arguments %v", args) app := &App{ Name: "boom", @@ -1664,7 +1663,7 @@ func TestApp_Run_Version(t *testing.T) { } output := buf.String() - log.Printf("output: %q\n", buf.Bytes()) + t.Logf("output: %q\n", buf.Bytes()) if !strings.Contains(output, "0.1.0") { t.Errorf("want version to contain %q, did not: \n%q", "0.1.0", output) @@ -2121,7 +2120,7 @@ func TestWhenExitSubCommandWithCodeThenAppQuitUnexpectedly(t *testing.T) { var exitCodeFromExitErrHandler int app.ExitErrHandler = func(c *Context, err error) { if exitErr, ok := err.(ExitCoder); ok { - log.Print(exitErr) + t.Log(exitErr) exitCodeFromExitErrHandler = exitErr.ExitCode() } }