testkit

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Rows

func Rows(args ...string) [][]interface{}

Rows is similar to RowsWithSep, use white space as separator string.

Types

type Result

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

Result is the result returned by MustQuery.

func (*Result) Check

func (res *Result) Check(expected [][]interface{})

Check asserts the result equals the expected results.

func (*Result) Rows

func (res *Result) Rows() [][]interface{}

Rows returns the result data.

func (*Result) Sort

func (res *Result) Sort() *Result

Sort sorts and return the result.

type TestKit

type TestKit struct {
	Se tidb.Session
	// contains filtered or unexported fields
}

TestKit is a utility to run sql test.

func NewTestKit

func NewTestKit(c *check.C, store kv.Storage) *TestKit

NewTestKit returns a new *TestKit.

func NewTestKitWithInit

func NewTestKitWithInit(c *check.C, store kv.Storage) *TestKit

NewTestKitWithInit returns a new *TestKit and creates a session.

func (*TestKit) CheckExecResult

func (tk *TestKit) CheckExecResult(affectedRows, insertID int64)

CheckExecResult checks the affected rows and the insert id after executing MustExec.

func (*TestKit) Exec

func (tk *TestKit) Exec(sql string, args ...interface{}) (ast.RecordSet, error)

Exec executes a sql statement.

func (*TestKit) MustExec

func (tk *TestKit) MustExec(sql string, args ...interface{})

MustExec executes a sql statement and asserts nil error.

func (*TestKit) MustQuery

func (tk *TestKit) MustQuery(sql string, args ...interface{}) *Result

MustQuery query the statements and returns result rows. If expected result is set it asserts the query result equals expected result.

Jump to

Keyboard shortcuts

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