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!
Read More:
- GitHub push ErrorThe requested URL returned error: 403 Forbidden while accessing
- Go run error go run: cannot run non main package
- Using Mocha to test can not find module ‘. /build/release/scrypt’ (Fixed)
- Error in idea unit test command line is too long
- Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:run (default-cli) on project
- Solution to Spacy’s failure to load (‘de ‘) or (‘en’)
- 【arm】arm-assembly-print-register-value-in-decimal
- [Solved] #command-line-arguments .\main.go:5:4: no new variables on left side of :=
- Troubleshooting of Jenkins upgrade to 2.42 JUnit test report
- Command line access to passive mode FTP server failed, 425 failed to establish connection
- Print regularly to activate the printer (for some printers that need to be activated to print)
- AttributeError: module ‘keras.backend‘ has no attribute ‘eager‘
- panic: runtime error: index out of range
- Solve GitHub push error 403 Forbidden while accessing
- Solve the MAC terminal download error curl: (7) failed to connect to raw.githubusercontent.com port 443: Connection refused
- Use of C + + ifstream and error handling
- Delete the specified crontab timer task under Linux
- Error: the main class usertest could not be found or loaded
- macos LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
- Solution to the error code of 0x80040154 in COM / ole call