testutils

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArgsDiff

func ArgsDiff(a, b []any) string

func Clean

func Clean(s string) string

func ErrDiff

func ErrDiff(a, b error) string

func QueryDiff

func QueryDiff(a, b string, clean FormatFunc) (string, error)

func RunExpressionTests

func RunExpressionTests(t *testing.T, d bob.Dialect, cases ExpressionTestcases)

func RunTests

func RunTests(t *testing.T, cases Testcases, format FormatFunc)

func TestDriver added in v0.17.1

func TestDriver[T any](t *testing.T, config DriverTestConfig[T])

Types

type DriverTestConfig added in v0.17.1

type DriverTestConfig[T any] struct {
	Root            string
	Templates       *helpers.Templates
	OverwriteGolden bool
	GoldenFile      string
	GetDriver       func() drivers.Interface[T]
}

type ExpressionTestcase

type ExpressionTestcase struct {
	Expression    bob.Expression
	ExpectedSQL   string
	ExpectedArgs  []any
	ExpectedError error
	Doc           string
}

Also used to generate documentation

type ExpressionTestcases

type ExpressionTestcases map[string]ExpressionTestcase

type FormatFunc added in v0.15.0

type FormatFunc = func(string) (string, error)

type Testcase

type Testcase struct {
	Query        bob.Query
	ExpectedSQL  string
	ExpectedArgs []any
	Doc          string
}

Also used to generate documentation

type Testcases

type Testcases map[string]Testcase

Jump to

Keyboard shortcuts

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