Documentation ¶
Index ¶
- func RegisterAfterCallback(cb func() error)
- func RunAfterCallbacks()
- func RunWithDB(t *testing.T, testFunc func(*TestDB))
- func RunWithServer(t *testing.T, handler func(net.Conn, *coelacanth.Server), ...)
- type TestDB
- func (db TestDB) Begin() (*sql.Tx, error)
- func (db TestDB) Close() error
- func (db TestDB) Exec(query string, args ...interface{}) (sql.Result, error)
- func (db TestDB) Prepare(query string) (*sql.Stmt, error)
- func (db TestDB) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (db TestDB) QueryRow(query string, args ...interface{}) *sql.Row
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterAfterCallback ¶
func RegisterAfterCallback(cb func() error)
RegisterAfterCallback registers a callback to be run after the last test
func RunAfterCallbacks ¶
func RunAfterCallbacks()
RunAfterCallbacks executes all registered callbacks
func RunWithServer ¶
func RunWithServer(t *testing.T, handler func(net.Conn, *coelacanth.Server), testFunc func(*coelacanth.Server, string))
RunWithServer executes testFunc with a prepared server
Types ¶
type TestDB ¶
type TestDB struct { coelacanth.DB // contains filtered or unexported fields }
TestDB is a testing database connection. Most calls are proxied to an internal transaction so they can be rolled back after each test.
func (TestDB) Close ¶
Close is a no-op. The connection is only closed at the conclusion of the test suite.
Click to show internal directories.
Click to hide internal directories.