Documentation
¶
Overview ¶
包gtest提供了方便的单元测试工具。 md5:b9acf1a8bbc8ea0c
Index ¶
- func Assert(value, expect interface{})
- func AssertEQ(value, expect interface{})
- func AssertGE(value, expect interface{})
- func AssertGT(value, expect interface{})
- func AssertIN(value, expect interface{})
- func AssertLE(value, expect interface{})
- func AssertLT(value, expect interface{})
- func AssertNE(value, expect interface{})
- func AssertNI(value, expect interface{})
- func AssertNQ(value, expect interface{})
- func AssertNil(value interface{})
- func C(t *testing.T, f func(t *T))
- func DataContent(names ...string) string
- func DataPath(names ...string) string
- func Error(message ...interface{})
- func Fatal(message ...interface{})
- type T
- func (t *T) Assert(value, expect interface{})
- func (t *T) AssertEQ(value, expect interface{})
- func (t *T) AssertGE(value, expect interface{})
- func (t *T) AssertGT(value, expect interface{})
- func (t *T) AssertIN(value, expect interface{})
- func (t *T) AssertLE(value, expect interface{})
- func (t *T) AssertLT(value, expect interface{})
- func (t *T) AssertNE(value, expect interface{})
- func (t *T) AssertNI(value, expect interface{})
- func (t *T) AssertNQ(value, expect interface{})
- func (t *T) AssertNil(value interface{})
- func (t *T) Error(message ...interface{})
- func (t *T) Fatal(message ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Assert ¶
func Assert(value, expect interface{})
Assert 检查 `value` 和 `expect` 是否相等。 md5:eaeea7c4fe0d764e
func AssertEQ ¶
func AssertEQ(value, expect interface{})
AssertEQ 检查 `value` 和 `expect` 是否相等,包括它们的类型。 md5:31097fa6b823a25a
func AssertGE ¶
func AssertGE(value, expect interface{})
AssertGE 检查 `value` 是否大于或等于 `expect`。 请注意,只有字符串、整数和浮点数类型可以使用 AssertGE 进行比较,其他类型是无效的。 md5:3227e007891ed72e
func AssertGT ¶
func AssertGT(value, expect interface{})
AssertGT 检查 `value` 是否大于 `expect`。 注意,只有字符串、整数和浮点数类型能使用 AssertGT 进行比较, 其他类型是无效的。 md5:647270894818c6c7
func AssertIN ¶
func AssertIN(value, expect interface{})
AssertIN 检查 `value` 是否在 `expect` 中。 `expect` 应该是一个切片, 但是 `value` 可以是切片或基本类型变量。 TODO: 添加对 map 的支持。 TODO: gconv.Strings(0) 不应该转换为 `[0]`。 md5:d8391e0c6cba6480
func AssertLE ¶
func AssertLE(value, expect interface{})
AssertLE 检查 `value` 是否小于或等于 `expect`。 请注意,只有字符串、整数和浮点类型可以通过 AssertLTE 进行比较,其他类型的值是无效的。 md5:bca4df91bef4e152
func AssertLT ¶
func AssertLT(value, expect interface{})
AssertLT 检查 `value` 是否小于等于 `expect`。 注意,只有字符串、整数和浮点类型可以通过 AssertLT 进行比较,其他类型无效。 md5:784a9db44c03122b
func AssertNE ¶
func AssertNE(value, expect interface{})
AssertNE 检查 `value` 和 `expect` 是否不相等。 md5:418e91b330bc944f
func AssertNI ¶
func AssertNI(value, expect interface{})
AssertNI 检查 `value` 不在 `expect` 中。 `expect` 应该是一个切片, 但是 `value` 可以是切片或基本类型变量。 TODO 增加对 map 的支持。 md5:483febd56930eb64
func AssertNQ ¶
func AssertNQ(value, expect interface{})
AssertNQ 检查 `value` 和 `expect` 是否不相等,包括它们的类型。 md5:bb13af00897290db
func C ¶
C 创建一个单元测试用例。 参数 `t` 是标准库 (*testing.T) 的 testing.T 指针。 参数 `f` 是用于单元测试的闭包函数。 md5:0a3ae380343ea962
func DataContent ¶
DataContent 从当前包的特定测试数据路径中检索并返回文件内容. md5:26224495ddbd389e
Types ¶
type T ¶
T 是测试用例管理对象。 md5:48ef1adf72668d4b
func (*T) Assert ¶
func (t *T) Assert(value, expect interface{})
Assert 检查 `value` 和 `expect` 是否相等。 md5:eaeea7c4fe0d764e
func (*T) AssertEQ ¶
func (t *T) AssertEQ(value, expect interface{})
AssertEQ 检查 `value` 和 `expect` 是否相等,包括它们的类型。 md5:31097fa6b823a25a
func (*T) AssertGE ¶
func (t *T) AssertGE(value, expect interface{})
AssertGE 检查 `value` 是否大于或等于 `expect`。 请注意,只有字符串、整数和浮点数类型可以使用 AssertGE 进行比较,其他类型是无效的。 md5:3227e007891ed72e
func (*T) AssertGT ¶
func (t *T) AssertGT(value, expect interface{})
AssertGT 检查 `value` 是否大于 `expect`。 注意,只有字符串、整数和浮点数类型能使用 AssertGT 进行比较, 其他类型是无效的。 md5:647270894818c6c7
func (*T) AssertIN ¶
func (t *T) AssertIN(value, expect interface{})
AssertIN 检查 `value` 是否在 `expect` 中。 `expect` 应该是一个切片, 但 `value` 可以是一个切片或一个基本类型变量。 md5:596913e44fc64a93
func (*T) AssertLE ¶
func (t *T) AssertLE(value, expect interface{})
AssertLE 检查 `value` 是否小于或等于 `expect`。 请注意,只有字符串、整数和浮点类型可以通过 AssertLTE 进行比较,其他类型的值是无效的。 md5:bca4df91bef4e152
func (*T) AssertLT ¶
func (t *T) AssertLT(value, expect interface{})
AssertLT 检查 `value` 是否小于等于 `expect`。 注意,只有字符串、整数和浮点类型可以通过 AssertLT 进行比较,其他类型无效。 md5:784a9db44c03122b
func (*T) AssertNE ¶
func (t *T) AssertNE(value, expect interface{})
AssertNE 检查 `value` 和 `expect` 是否不相等。 md5:418e91b330bc944f
func (*T) AssertNI ¶
func (t *T) AssertNI(value, expect interface{})
AssertNI 检查 `value` 不在 `expect` 列表中。 `expect` 应该是一个切片, 而 `value` 可以是一个切片或基本类型变量。 md5:8657bc61646e08fc
func (*T) AssertNQ ¶
func (t *T) AssertNQ(value, expect interface{})
AssertNQ 检查 `value` 和 `expect` 是否不相等,包括它们的类型。 md5:bb13af00897290db
func (*T) AssertNil ¶
func (t *T) AssertNil(value interface{})
AssertNil 断言 `value` 为 nil。 md5:94a00206ff503e10