go testing
来源:互联网 发布:mac光盘怎么弹出 编辑:程序博客网 时间:2024/04/30 11:14
官方文档 点击打开链接
demo 如下:
add.go
package simplemathfunc Add(a int, b int) int { return a + b}
add_test.go
package simplemathimport "testing"/**在任意目录下运行单元测试如下go test simplemath */func TestAdd1(t *testing.T) { r := Add(1, 2) if r != 3 { t.Errorf("Add(1, 2) failed . Got %的, expect 3. ", r) }}
运行:
go test simplemath
输出:
ok simplemath 0.005s
代码见 https://github.com/robertzhai/go/tree/master/go_programming_study/src/simplemath
0 0
- go testing
- Go-Testing
- go testing
- go testing:单元测试
- 5.go开源groupcache项目笔记——关于testing
- testing
- Testing
- testing
- Testing
- Testing
- Testing....
- Testing
- testing
- testing
- testing
- Testing
- testing
- testing
- 解析 FBX 模型文件作为 Direct3D 的渲染模型
- 每天一个常用的linux命令(9)--cp
- idl之结构体
- 机器学习知识体系结构
- Fragment的生命周期和相关UI框架搭建
- go testing
- java代码实现对文件的base64加密解密
- 技术上遭遇的未解之“迷”们
- 云栖大会马总演讲:《未来属于善于拥抱未来的人》
- HDU 4556 法里数列
- 设计模式 - 享元模式
- iOS 金额余额从0跳动显示的动画
- CallableStatement 调用存贮过程
- 教你怎么快速配置 React