tidb: github.com/pingcap/tidb/util/testutil Index | Files

package testutil

import "github.com/pingcap/tidb/util/testutil"


Package Files



var ConfigTestUtils configTestUtils

ConfigTestUtils contains a set of set-up/restore methods related to config used in tests.

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))

func CompareUnorderedStringSlice Uses

func CompareUnorderedStringSlice(a []string, b []string) bool

CompareUnorderedStringSlice compare two string slices. If a and b is exactly the same except the order, it returns true. In otherwise return false.

func RowsWithSep Uses

func RowsWithSep(sep string, args ...string) [][]interface{}

RowsWithSep is a convenient function to wrap args to a slice of []interface. The arg represents a row, split by sep.

type TestData Uses

type TestData struct {
    // contains filtered or unexported fields

TestData stores all the data of a test suite.

func LoadTestSuiteData Uses

func LoadTestSuiteData(dir, suiteName string) (res TestData, err error)

LoadTestSuiteData loads test suite data from file.

func (*TestData) ConvertRowsToStrings Uses

func (t *TestData) ConvertRowsToStrings(rows [][]interface{}) (rs []string)

ConvertRowsToStrings converts [][]interface{} to []string.

func (*TestData) ConvertSQLWarnToStrings Uses

func (t *TestData) ConvertSQLWarnToStrings(warns []stmtctx.SQLWarn) (rs []string)

ConvertSQLWarnToStrings converts []SQLWarn to []string.

func (*TestData) GenerateOutputIfNeeded Uses

func (t *TestData) GenerateOutputIfNeeded() error

GenerateOutputIfNeeded generate the output file.

func (*TestData) GetTestCases Uses

func (t *TestData) GetTestCases(c *check.C, in interface{}, out interface{})

GetTestCases gets the test cases for a test function.

func (*TestData) GetTestCasesByName Uses

func (t *TestData) GetTestCasesByName(caseName string, c *check.C, in interface{}, out interface{})

GetTestCasesByName gets the test cases for a test function by its name.

func (*TestData) OnRecord Uses

func (t *TestData) OnRecord(updateFunc func())

OnRecord execute the function to update result.

Package testutil imports 20 packages (graph) and is imported by 34 packages. Updated 2020-05-24. Refresh now. Tools for package owners.