has a test file:
$ cat utils/utils_test.go
package utils
import (
"fmt"
"testing"
)
func TestGetProjAbsPath(t *testing.T) {
projPath := GetProjAbsPath("github.com", "GerryLon", "go-crawler")
t.Log(projPath)
fmt.Println("projPath is:", projPath)
}
runs as follows:
$ go test -count=1 utils/*.go
ok command-line-arguments 0.002s
does not see print, neither t.og nor FMT.Println.
Add the
plus -v
(verbose) option to see the whole process :
$ go test -v utils/*.go
=== RUN TestGetProjAbsPath
projPath is: /var/workspace/go/src/github.com/GerryLon/go-crawler
--- PASS: TestGetProjAbsPath (0.00s)
utils_test.go:10: /var/workspace/go/src/github.com/GerryLon/go-crawler
PASS
ok command-line-arguments (cached)
Reference:
p>
https://stackoverflow.com/questions/23205419/how-do-you-print-in-a-go-test-using-the-testing-package
welcome to add correction!