test

package
v0.0.0-...-66b15f9 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package test contains test helper functions dealing with a database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DbWithTestTable

func DbWithTestTable() (*sql.DB, error)

DbWIthTestTable creates a test database with one small table called test.

func EmptyReposAndSqlFile

func EmptyReposAndSqlFile(setupfile string) (*dbrepo.Repos, func(), error)

ReposAndSqlFile creates a test Repos and loads the specified SQL file. It does not create the standard tables.

func ReposAndLoadFile

func ReposAndLoadFile(setupfile string) (*dbrepo.Repos, func(), error)

ReposAndLoadFile creates a test Repos with the default set of tables, then imports the specified JRaceman-format file.

func ReposEmpty

func ReposEmpty() (*dbrepo.Repos, func(), error)

ReposEmpty creates an empty test Repos. The second return value is the cleanup function. Tests should call this function to ensure that everything is properly cleaned up at the end of each test.

func ReposEmptyInMemory

func ReposEmptyInMemory() (*dbrepo.Repos, func(), error)

ReposEmptyInMemory create an empty in-memory Repos for use with unit tests.

func ReposEmptyTempFile

func ReposEmptyTempFile() (*dbrepo.Repos, func(), error)

ReposEmptyTempFile create an empty Repos database using a temp file for use with unit tests.

Types

type TestRecord

type TestRecord struct {
	ID string
	N  int
	S  string
	S2 *string
}

Struct TestRecord matches the format of the test table created by DbWithTestTable.

Jump to

Keyboard shortcuts

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