Documentation
¶
Index ¶
- Variables
- func CompareUnorderedStringSlice(a []string, b []string) bool
- func MaskSortHandles(handles []int64, shardBitsCount int, fieldType byte) []int64
- func MustNewCommonHandle(c *check.C, values ...interface{}) kv.Handle
- func RowsWithSep(sep string, args ...string) [][]interface{}
- type CommonHandleSuite
- type TestData
- func (t *TestData) ConvertRowsToStrings(rows [][]interface{}) (rs []string)
- func (t *TestData) ConvertSQLWarnToStrings(warns []stmtctx.SQLWarn) (rs []string)
- func (t *TestData) GenerateOutputIfNeeded() error
- func (t *TestData) GetTestCases(c *check.C, in interface{}, out interface{})
- func (t *TestData) GetTestCasesByName(caseName string, c *check.C, in interface{}, out interface{})
- func (t *TestData) OnRecord(updateFunc func())
Constants ¶
This section is empty.
Variables ¶
var DatumEquals check.Checker = &datumEqualsChecker{ &check.CheckerInfo{Name: "DatumEquals", Params: []string{"obtained", "expected"}}, }
DatumEquals checker verifies that the obtained value is equal to the expected value. For example:
c.Assert(value, DatumEquals, NewDatum(42))
TODO: please use trequire.DatumEqual to replace this function to migrate to testify
var HandleEquals = &handleEqualsChecker{ &check.CheckerInfo{Name: "HandleEquals", Params: []string{"obtained", "expected"}}, }
HandleEquals checker verifies that the obtained handle is equal to the expected handle. For example:
c.Assert(value, HandleEquals, kv.IntHandle(42))
Functions ¶
func CompareUnorderedStringSlice ¶
CompareUnorderedStringSlice compare two string slices. If a and b is exactly the same except the order, it returns true. In otherwise return false.
func MaskSortHandles ¶
MaskSortHandles sorts the handles by lowest (fieldTypeBits - 1 - shardBitsCount) bits.
func MustNewCommonHandle ¶
MustNewCommonHandle create a common handle with given values. TODO: please use testkit.MustNewCommonHandle to replace this function to migrate to testify
func RowsWithSep ¶
RowsWithSep is a convenient function to wrap args to a slice of []interface. The arg represents a row, split by sep.
Types ¶
type CommonHandleSuite ¶
type CommonHandleSuite struct {
IsCommonHandle bool
}
CommonHandleSuite is used to adapt kv.CommonHandle to existing kv.IntHandle tests.
Usage:
type MyTestSuite struct {
CommonHandleSuite
}
func (s *MyTestSuite) TestSomething(c *C) {
// ...
s.RerunWithCommonHandleEnabled(c, s.TestSomething)
}
func (*CommonHandleSuite) NewHandle ¶
func (chs *CommonHandleSuite) NewHandle() *commonHandleSuiteNewHandleBuilder
NewHandle create a handle according to CommonHandleSuite.IsCommonHandle.
func (*CommonHandleSuite) RerunWithCommonHandleEnabled ¶
func (chs *CommonHandleSuite) RerunWithCommonHandleEnabled(c *check.C, f func(*check.C))
RerunWithCommonHandleEnabled runs a test function with IsCommonHandle enabled.
type TestData ¶
type TestData struct {
// contains filtered or unexported fields
}
TestData stores all the data of a test suite. TODO: please use testkit.TestData to migrate to testify
func LoadTestSuiteData ¶
LoadTestSuiteData loads test suite data from file.
func (*TestData) ConvertRowsToStrings ¶
ConvertRowsToStrings converts [][]interface{} to []string.
func (*TestData) ConvertSQLWarnToStrings ¶
ConvertSQLWarnToStrings converts []SQLWarn to []string.
func (*TestData) GenerateOutputIfNeeded ¶
GenerateOutputIfNeeded generate the output file.
func (*TestData) GetTestCases ¶
GetTestCases gets the test cases for a test function.
func (*TestData) GetTestCasesByName ¶
GetTestCasesByName gets the test cases for a test function by its name.