go-testing-interface:Go(golang)库将* testing.T公开为接口

时间:2021-05-10 14:24:56
【文件属性】:
文件名称:go-testing-interface:Go(golang)库将* testing.T公开为接口
文件大小:5KB
文件格式:ZIP
更新时间:2021-05-10 14:24:56
Go 去测试界面 go-testing-interface是一个Go库,可导出*testing.T实现的接口以及可以在其位置使用的运行时版本。 该库的目的是使您可以将测试助手作为公共API导出,而无需依赖“测试”包,因为您不能手动创建*testing.T结构。 例如,这使您可以使用公共测试API在运行时而不是仅在测试时生成模拟数据。 用法与范例 有关用法和示例,请参见 。 给定一个使用go-testing-interface编写的测试助手,如下所示: import "github.com/mitchellh/go-testing-interface" func TestHelper(t testing.T) { t.Fatal("I failed") } 您可以轻松地在真实测试中致电测试助手: import "testing" func TestThing(t *testing.
【文件预览】:
go-testing-interface-master
----testing_test.go(245B)
----go.mod(58B)
----LICENSE(1KB)
----.github()
--------workflows()
----README.md(2KB)
----testing.go(6KB)

网友评论