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:
- Python3 reports an error [errno 5] input / output error. Print is used when there is no stdout
- After the new video card rtx3060 arrives, configure tensorflow and run “TF. Test. Is”_ gpu_ The solution of “available ()” output false
- How to print how to output Int64_ t,uint64_ The value of T in C
- Print regularly to activate the printer (for some printers that need to be activated to print)
- [Solved] #command-line-arguments .\main.go:5:4: no new variables on left side of :=
- Go get github.com/kotakanbe/go -Problems encountered in CVE dictionary Download
- Go run error go run: cannot run non main package
- Vue + antd writes wrong output statement, resulting in no error report and no form submission
- import org.junit.Test And @ test error reporting — solutions
- Python normality test: test whether the data obey the normal distribution
- standard_init_linux.go:178: exec user process caused “no such file or directory”
- Attributeerror: ‘STR’ object has no attribute ‘decode’ solution: the pro test is successful.
- 【arm】arm-assembly-print-register-value-in-decimal
- Successfully solved the problem that visual studio code could not go to the definition, and there was no mouse prompt
- Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test)
- Missing parents in call to ‘print’
- Tensorflow in function tf.Print Method of outputting intermediate value
- Android studio view System.out.print Content of
- In Python, print() prints to remove line breaks
- Springboot + mybatis + logback does not print SQL problems on the console