testing

package
v0.0.0-...-3d4eebd Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 10 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Expect

func Expect[A any](t testing.TB, actual A, matchers ...Matcher[A])

func NewCompareMatcher

func NewCompareMatcher[A any, E any](name string, match func(a A, e E) bool) func(e E) Matcher[A]

func ProjectRoot

func ProjectRoot() string

func WithSnapshotUpdate

func WithSnapshotUpdate() func(m *snapshotMatcher)

func WithWorkDir

func WithWorkDir(wd string) func(m *snapshotMatcher)

Types

type ExpectedFormatter

type ExpectedFormatter interface {
	FormatExpected() string
}

type Matcher

type Matcher[A any] interface {
	Name() string
	Negative() bool
	Match(actual A) bool
	FormatActual(actual A) string
}

func Be

func Be[T any](e T) Matcher[T]

func BeEmpty

func BeEmpty[T any]() Matcher[T]

func BeFalse

func BeFalse() Matcher[bool]

func BeNil

func BeNil[T any]() Matcher[T]

func BeTrue

func BeTrue() Matcher[bool]

func Equal

func Equal[T any](e T) Matcher[T]

func HaveCap

func HaveCap[T any](c int) Matcher[T]

func HaveLen

func HaveLen[T any](c int) Matcher[T]

func MatchSnapshot

func MatchSnapshot(name string, optionFuncs ...func(m *snapshotMatcher)) Matcher[*txtar.Archive]

func NewMatcher

func NewMatcher[A any](name string, match func(a A) bool) Matcher[A]

func Not

func Not[A any](matcher Matcher[A]) Matcher[A]

func NotBe

func NotBe[T any](e T) Matcher[T]

func NotBeEmpty

func NotBeEmpty[T any]() Matcher[T]

func NotBeNil

func NotBeNil[T any]() Matcher[T]

func NotEqual

func NotEqual[T any](e T) Matcher[T]

func NotHaveCap

func NotHaveCap[T any](c int) Matcher[T]

func NotHaveLen

func NotHaveLen[T any](c int) Matcher[T]

Jump to

Keyboard shortcuts

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