test

package
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package test 提供了整个包的基本测试数据

Index

Constants

This section is empty.

Variables

View Source
var (
	// Sqlite3 Dialect 实例
	Sqlite3 = dialect.Sqlite3("sqlite3")

	// Mysql Dialect 实例
	Mysql = dialect.Mysql("mysql")

	// Mariadb Dialect 实例
	Mariadb = dialect.Mariadb("mysql")

	// Postgres Dialect 实例
	Postgres = dialect.Postgres("postgres")
)

Functions

This section is empty.

Types

type Driver

type Driver struct {
	*assert.Assertion
	DB         *orm.DB
	DriverName string
	DBName     string
	// contains filtered or unexported fields
}

Driver 单个测试用例

type Suite

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

Suite 测试用例管理

func NewSuite

func NewSuite(a *assert.Assertion, dialect ...core.Dialect) *Suite

NewSuite 初始化测试内容

dialect 指定了当前需要测试的驱动,如果未指定表示需要测全部,否则只测试指定内容。 同时 dialect 还受到 flagsets.Flags 变量的影响,如果未在其中指定的,也不会执行测试。

func (Suite) Close

func (s Suite) Close()

Close 销毁测试用例并关闭数据库

如果是 sqlite3,还会删除数据库文件。

func (Suite) ForEach

func (s Suite) ForEach(f func(*Driver))

ForEach 为每个数据库测试用例调用 f 进行测试

dialects 为需要测试的驱动,如果为空表示测试全部

Jump to

Keyboard shortcuts

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