replace t.Logf with log.Printf, replace t.Log with log.Print and add gopath to bin

This commit is contained in:
Ajitem Sahasrabuddhe 2019-12-01 21:25:06 +05:30
parent aae5025f27
commit b6d04dbae4
2 changed files with 15 additions and 8 deletions

View File

@ -22,6 +22,12 @@ jobs:
with:
go-version: ${{ matrix.go }}
- name: Set GOPATH and PATH
run: |
echo "##[set-env name=GOPATH;]$(dirname $GITHUB_WORKSPACE)"
echo "##[add-path]$(dirname $GITHUB_WORKSPACE)/bin"
shell: bash
- name: Checkout Code
uses: actions/checkout@v1
with:

View File

@ -7,6 +7,7 @@ import (
"fmt"
"io"
"io/ioutil"
"log"
"os"
"reflect"
"strings"
@ -1422,7 +1423,7 @@ func TestApp_Run_CommandWithSubcommandHasHelpTopic(t *testing.T) {
}
for _, flagSet := range subcommandHelpTopics {
t.Logf("==> checking with flags %v", flagSet)
log.Printf("==> checking with flags %v", flagSet)
app := &App{}
buf := new(bytes.Buffer)
@ -1451,7 +1452,7 @@ func TestApp_Run_CommandWithSubcommandHasHelpTopic(t *testing.T) {
}
output := buf.String()
//t.Logf("output: %q\n", buf.Bytes())
//log.Printf("output: %q\n", buf.Bytes())
if strings.Contains(output, "No help topic for") {
t.Errorf("expect a help topic, got none: \n%q", output)
@ -1613,7 +1614,7 @@ func TestApp_Run_Help(t *testing.T) {
for _, args := range helpArguments {
buf := new(bytes.Buffer)
t.Logf("==> checking with arguments %v", args)
log.Printf("==> checking with arguments %v", args)
app := &App{
Name: "boom",
@ -1631,7 +1632,7 @@ func TestApp_Run_Help(t *testing.T) {
}
output := buf.String()
t.Logf("output: %q\n", buf.Bytes())
log.Printf("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 +1646,7 @@ func TestApp_Run_Version(t *testing.T) {
for _, args := range versionArguments {
buf := new(bytes.Buffer)
t.Logf("==> checking with arguments %v", args)
log.Printf("==> checking with arguments %v", args)
app := &App{
Name: "boom",
@ -1664,7 +1665,7 @@ func TestApp_Run_Version(t *testing.T) {
}
output := buf.String()
t.Logf("output: %q\n", buf.Bytes())
log.Printf("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)
@ -1718,7 +1719,7 @@ func TestApp_Run_Categories(t *testing.T) {
}
output := buf.String()
//t.Logf("output: %q\n", buf.Bytes())
//log.Printf("output: %q\n", buf.Bytes())
if !strings.Contains(output, "1:\n command1") {
t.Errorf("want buffer to include category %q, did not: \n%q", "1:\n command1", output)
@ -2122,7 +2123,7 @@ func TestWhenExitSubCommandWithCodeThenAppQuitUnexpectedly(t *testing.T) {
var exitCodeFromExitErrHandler int
app.ExitErrHandler = func(c *Context, err error) {
if exitErr, ok := err.(ExitCoder); ok {
t.Log(exitErr)
log.Print(exitErr)
exitCodeFromExitErrHandler = exitErr.ExitCode()
}
}