tests

package module
v0.0.0-...-c95aa64 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PlaceholderPattern = regexp.MustCompile(`\$(\d+)`)

Functions

func CR

func CR() string

func CaptureLog

func CaptureLog(fn func()) string

func PG

func PG() string

func Row

func Row(db TestableDB, sql string, args ...any) typed.Typed

func Rows

func Rows(db TestableDB, sql string, args ...any) []typed.Typed

func StorageType

func StorageType() string

Types

type Generator

type Generator struct{}

func (Generator) String

func (g Generator) String(constraints ...int) string

Generate a random string No arguments: 0-200 length Single integer: exactly N length Two integers: between A and B lengths

func (Generator) UUID

func (_ Generator) UUID() string

type TestableDB

type TestableDB interface {
	Placeholder(i int) string
	IsNotFound(err error) bool
	RowToMap(sql string, args ...any) (typed.Typed, error)
	RowsToMap(sql string, args ...any) ([]typed.Typed, error)
}

Source Files

  • generator.go
  • test.go

Directories

Path Synopsis
A wrapper around *testing.T. I hate the if a != b { t.ErrorF(....) } pattern.
A wrapper around *testing.T. I hate the if a != b { t.ErrorF(....) } pattern.

Jump to

Keyboard shortcuts

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