首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >go test 使用总结

go test 使用总结

作者头像
solate
发布2019-07-22 17:27:04
发布2019-07-22 17:27:04
1.2K0
举报
文章被收录于专栏:solate 杂货铺solate 杂货铺

go test

直接输入 go test 不会打印t.Log记录的信息,

所以查看文档,发现需要 -v 参数。

go test -v 成功也会打印 t.Log 和 t.Logf的记录

代码语言:javascript
复制
Verbose output: log all tests as they are run. Also print all
text from Log and Logf calls even if the test succeeds.

使用

1,测试单个文件,一定要带上被测试的原文件(如果包含多个文件需要添加多个)

代码语言:javascript
复制
Go test -v  wechat_test.go wechat.go 

2,测试单个方法

代码语言:javascript
复制
go test -v -test.run TestRefreshAccessToken

参考

go test 测试单个文件和测试单个函数

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除
目录
  • go test
  • 使用
  • 参考
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档