testutil

package
v3.1.0-fork Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigTestUtils configTestUtils

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

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

Functions

func CompareUnorderedStringSlice

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

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.

Types

type TestData

type TestData struct {
	// contains filtered or unexported fields
}

TestData stores all the data of a test suite.

func LoadTestSuiteData

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

LoadTestSuiteData loads test suite data from file.

func (*TestData) ConvertRowsToStrings

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

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

func (*TestData) ConvertSQLWarnToStrings

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

ConvertSQLWarnToStrings converts []SQLWarn to []string.

func (*TestData) GenerateOutputIfNeeded

func (t *TestData) GenerateOutputIfNeeded() error

GenerateOutputIfNeeded generate the output file.

func (*TestData) GetTestCases

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

GetTestCases gets the test cases for a test function.

func (*TestData) GetTestCasesByName

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

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

OnRecord execute the function to update result.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL