testutil

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package testutil a Test only package for harness to load, implement SQL tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecSpec

func ExecSpec(t TestingT, q *QuerySpec)

ExecSpec execute a queryspec test

func ExecSqlSpec

func ExecSqlSpec(t TestingT, q *QuerySpec)

ExecSqlSpec execute a test harness of QuerySpec

func RunDDLTests

func RunDDLTests(t TestingT)

RunDDLTests run the DDL (CREATE SCHEMA, TABLE, alter) test harness suite.

func RunSimpleSuite

func RunSimpleSuite(t TestingT)

RunSimpleSuite run the normal DML SQL test suite.

func RunTestSuite

func RunTestSuite(t TestingT)

RunTestSuite run the normal DML SQL test suite.

func Setup

func Setup()

Setup enables -vv verbose logging or sends logs to /dev/null env var VERBOSELOGS=true was added to support verbose logging with alltests

func TestExec

func TestExec(t TestingT, sql string)

func TestSelect

func TestSelect(t TestingT, sql string, expects [][]driver.Value)

func TestSelectErr

func TestSelectErr(t TestingT, sql string, expects [][]driver.Value)

func TestSqlSelect

func TestSqlSelect(t TestingT, source, sql string, expects [][]driver.Value)

TestSqlSelect tests using the database/sql driver

Types

type QuerySpec

type QuerySpec struct {
	Source          string // Db source
	Sql             string
	Exec            string
	HasErr          bool
	Cols            []string
	ValidateRow     func([]interface{})
	ExpectRowCt     int
	ExpectColCt     int
	RowData         interface{}
	Expect          [][]driver.Value
	ValidateRowData func()
}

QuerySpec a test harness

type TestingT

type TestingT interface {
	Errorf(format string, args ...interface{})
}

TestingT is an interface wrapper around *testing.T so when we import this go dep, govendor don't import "testing"

Jump to

Keyboard shortcuts

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