首页
注册
登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请
登录
V2EX
›
Sunshineplan
›
全部回复第 1 页 / 共 1 页
回复总数
5
6 天前
回复了
inSpring
创建的主题
›
Go 编程语言
›
做个调研, go 语言,大家在用哪个 http 请求库?
https://github.com/sunshineplan/gohttp
6 天前
回复了
inSpring
创建的主题
›
Go 编程语言
›
做个调研, go 语言,大家在用哪个 http 请求库?
gohttp
2022-03-22 11:52:13 +08:00
回复了
BeautifulSoap
创建的主题
›
Go 编程语言
›
go 泛型函数的单元测试实在是太"难"写了
```go
func runTestCases[T constraints.Ordered](t *testing.T, name string, a, b, want T) {
t.Run
(name, func(t *testing.T) {
if got := Add(a, b); !reflect.DeepEqual(got, want) {
t.Errorf("xxxxxxxxxxxxxx")
}
})
}
func TestAdd(t *testing.T) {
runTestCases(t, "ok", 1, 1, 2)
runTestCases(t, "ok2", 10, 10, 20)
runTestCases(t, "ok", "A", "B", "AB")
runTestCases(t, "ok2", "Hello", "World", "HelloWorld")
}
```
这样行么?
关于
·
帮助文档
·
博客
·
API
·
FAQ
·
实用小工具
·
3506 人在线
最高记录 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 12ms ·
UTC 00:17
·
PVG 08:17
·
LAX 17:17
·
JFK 20:17
Developed with
CodeLauncher
♥ Do have faith in what you're doing.