package
Version:
v0.18.0
Opens a new window with list of versions in this module.
Published: Mar 21, 2021
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 6
Opens a new window with list of known importers.
Documentation
¶
package assert 提供了单元测试时的断言功能,减少一些模板代码
func Equal(t TestingT, expected interface{}, actual interface{}, msg ...string)
比如有时我们需要对 error 类型不等于 nil 做断言,但是我们并不关心 error 的具体值是什么
type TestingT interface {
Errorf(format string, args ...interface{})
}
单元测试中的 *testing.T 和 *testing.B 都满足该接口
Source Files
¶
Click to show internal directories.
Click to hide internal directories.