replace log.Print with t.Log
This commit is contained in:
parent
078d14335a
commit
969535eec6
13
app_test.go
13
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()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user