Documentation ¶
Overview ¶
Package gtest provides convenient test utilities for unit testing.
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 AssertEQ ¶
func AssertEQ(value, expect interface{})
AssertEQ checks `value` and `expect` EQUAL, including their TYPES.
func AssertGE ¶
func AssertGE(value, expect interface{})
AssertGE checks `value` is GREATER OR EQUAL THAN `expect`. Notice that, only string, integer and float types can be compared by AssertGTE, others are invalid.
func AssertGT ¶
func AssertGT(value, expect interface{})
AssertGT checks `value` is GREATER THAN `expect`. Notice that, only string, integer and float types can be compared by AssertGT, others are invalid.
func AssertIN ¶
func AssertIN(value, expect interface{})
AssertIN checks `value` is IN `expect`. The `expect` should be a slice, but the `value` can be a slice or a basic type variable. TODO map support.
func AssertLE ¶
func AssertLE(value, expect interface{})
AssertLE checks `value` is LESS OR EQUAL THAN `expect`. Notice that, only string, integer and float types can be compared by AssertLTE, others are invalid.
func AssertLT ¶
func AssertLT(value, expect interface{})
AssertLT checks `value` is LESS EQUAL THAN `expect`. Notice that, only string, integer and float types can be compared by AssertLT, others are invalid.
func AssertNE ¶
func AssertNE(value, expect interface{})
AssertNE checks `value` and `expect` NOT EQUAL.
func AssertNI ¶
func AssertNI(value, expect interface{})
AssertNI checks `value` is NOT IN `expect`. The `expect` should be a slice, but the `value` can be a slice or a basic type variable. TODO map support.
func AssertNQ ¶ added in v1.12.2
func AssertNQ(value, expect interface{})
AssertNQ checks `value` and `expect` NOT EQUAL, including their TYPES.
func AssertNil ¶ added in v1.15.4
func AssertNil(value interface{})
AssertNil asserts `value` is nil.
func C ¶ added in v1.12.0
C creates a unit testing case. The parameter `t` is the pointer to testing.T of stdlib (*testing.T). The parameter `f` is the closure function for unit testing case.
func DataContent ¶ added in v1.16.7
DataContent retrieves and returns the file content for specified testdata path of current package
Types ¶
type T ¶ added in v1.12.0
T is the testing unit case management object.
func (*T) Assert ¶ added in v1.12.0
func (t *T) Assert(value, expect interface{})
Assert checks `value` and `expect` EQUAL.
func (*T) AssertEQ ¶ added in v1.12.0
func (t *T) AssertEQ(value, expect interface{})
AssertEQ checks `value` and `expect` EQUAL, including their TYPES.
func (*T) AssertGE ¶ added in v1.12.0
func (t *T) AssertGE(value, expect interface{})
AssertGE checks `value` is GREATER OR EQUAL THAN `expect`. Notice that, only string, integer and float types can be compared by AssertGTE, others are invalid.
func (*T) AssertGT ¶ added in v1.12.0
func (t *T) AssertGT(value, expect interface{})
AssertGT checks `value` is GREATER THAN `expect`. Notice that, only string, integer and float types can be compared by AssertGT, others are invalid.
func (*T) AssertIN ¶ added in v1.12.0
func (t *T) AssertIN(value, expect interface{})
AssertIN checks `value` is IN `expect`. The `expect` should be a slice, but the `value` can be a slice or a basic type variable.
func (*T) AssertLE ¶ added in v1.12.0
func (t *T) AssertLE(value, expect interface{})
AssertLE checks `value` is LESS OR EQUAL THAN `expect`. Notice that, only string, integer and float types can be compared by AssertLTE, others are invalid.
func (*T) AssertLT ¶ added in v1.12.0
func (t *T) AssertLT(value, expect interface{})
AssertLT checks `value` is LESS EQUAL THAN `expect`. Notice that, only string, integer and float types can be compared by AssertLT, others are invalid.
func (*T) AssertNE ¶ added in v1.12.0
func (t *T) AssertNE(value, expect interface{})
AssertNE checks `value` and `expect` NOT EQUAL.
func (*T) AssertNI ¶ added in v1.12.0
func (t *T) AssertNI(value, expect interface{})
AssertNI checks `value` is NOT IN `expect`. The `expect` should be a slice, but the `value` can be a slice or a basic type variable.
func (*T) AssertNQ ¶ added in v1.12.2
func (t *T) AssertNQ(value, expect interface{})
AssertNQ checks `value` and `expect` NOT EQUAL, including their TYPES.
func (*T) AssertNil ¶ added in v1.15.4
func (t *T) AssertNil(value interface{})
AssertNil asserts `value` is nil.