英文:
Explicitly specifying the main package to run tests for in golang with goconvey
问题
你可以使用以下命令来只运行主包中的测试,而不运行其他包中的测试:
go test -v ./...
这将运行当前目录下所有包的测试。如果你只想运行主包的测试,可以使用以下命令:
go test -v .
这将只运行当前目录中的主包测试。希望对你有帮助!
英文:
How do I explicitly say with my go test command to run only tests for the main package and not others in my source directory.
At the moment it's working with $go test -v
. But... I am using goconvey as well and it seems to be running recursively. According to this page https://github.com/smartystreets/goconvey/wiki/Profiles I have a file where I can pass arguments into the go test command. I know you can go test -v ./...
for recursive or go test -c packagename/...
but how do I just do it for the main?
答案1
得分: 1
Profiles是一种实现这一目标的方法,但你也可以为runner指定一个'depth':
$ goconvey -depth=0
值为0
将限制runner在工作目录中运行。
运行goconvey -help
以获取详细信息。
英文:
Profiles is one to accomplish this, but you can also specify a 'depth' for the runner:
$ goconvey -depth=0
A value of 0
limits the runner to the working directory.
Run goconvey -help
for details.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论