should

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package should info: github.com/mdwhatcott/testing/should@v0.20.1 (a little copy-paste is better than a little dependency) AUTO-GENERATED: 2023-01-18 14:06:49.960562 -0700 MST m=+0.003159418

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExpectedCountInvalid = errors.New("expected count invalid")
	ErrTypeMismatch         = errors.New("type mismatch")
	ErrKindMismatch         = errors.New("kind mismatch")
	ErrAssertionFailure     = errors.New("assertion failure")
)
View Source
var NOT negated

Functions

func BeChronological

func BeChronological(actual any, expected ...any) error

func BeEmpty

func BeEmpty(actual any, expected ...any) error

func BeFalse

func BeFalse(actual any, expected ...any) error

func BeGreaterThan

func BeGreaterThan(actual any, EXPECTED ...any) error

func BeGreaterThanOrEqualTo

func BeGreaterThanOrEqualTo(actual any, expected ...any) error

func BeIn

func BeIn(actual any, expected ...any) error

func BeLessThan

func BeLessThan(actual any, EXPECTED ...any) error

func BeLessThanOrEqualTo

func BeLessThanOrEqualTo(actual any, expected ...any) error

func BeNil

func BeNil(actual any, expected ...any) error

func BeTrue

func BeTrue(actual any, expected ...any) error

func Contain

func Contain(actual any, expected ...any) error

func EndWith

func EndWith(actual any, expected ...any) error

func Equal

func Equal(actual any, EXPECTED ...any) error

func HappenAfter

func HappenAfter(actual any, expected ...any) error

func HappenBefore

func HappenBefore(actual any, expected ...any) error

func HappenOn

func HappenOn(actual any, expected ...any) error

func HaveLength

func HaveLength(actual any, expected ...any) error

func Panic

func Panic(actual any, expected ...any) (err error)

func Run

func Run(fixture any, options ...Option)

func So

func So(t *testing.T, actual any, assertion Func, expected ...any)

func StartWith

func StartWith(actual any, expected ...any) error

func WrapError

func WrapError(actual any, expected ...any) error

Types

type CompositeReporter

type CompositeReporter struct {
	// contains filtered or unexported fields
}

func NewCompositeReporter

func NewCompositeReporter(reporters ...Reporter) *CompositeReporter

func (*CompositeReporter) Report

func (this *CompositeReporter) Report(err error)

func (*CompositeReporter) Write

func (this *CompositeReporter) Write(p []byte) (n int, err error)

type Func

type Func func(actual any, expected ...any) error

type LogReporter

type LogReporter struct {
	// contains filtered or unexported fields
}

func NewLogReporter

func NewLogReporter(logger *log.Logger) *LogReporter

func (LogReporter) Report

func (this LogReporter) Report(err error)

func (LogReporter) Write

func (this LogReporter) Write(p []byte) (n int, err error)

type Opt

type Opt struct{}
var Options Opt

func (Opt) FreshFixture

func (Opt) FreshFixture() Option

func (Opt) IntegrationTests

func (Opt) IntegrationTests() Option

func (Opt) ParallelFixture

func (Opt) ParallelFixture() Option

func (Opt) ParallelTests

func (Opt) ParallelTests() Option

func (Opt) SharedFixture

func (Opt) SharedFixture() Option

func (Opt) UnitTests

func (Opt) UnitTests() Option

type Option

type Option func(*config)

type Reporter

type Reporter interface {
	Report(error)
	io.Writer
}

type T

type T struct{ Reporter }

func New

func New(t *testing.T) *T

func Report

func Report(reporters ...Reporter) *T

func (*T) So

func (this *T) So(actual any, assertion Func, expected ...any) (ok bool)

type TestingReporter

type TestingReporter struct{ *testing.T }

func NewTestingReporter

func NewTestingReporter(t *testing.T) *TestingReporter

func (*TestingReporter) Report

func (this *TestingReporter) Report(err error)

func (*TestingReporter) Write

func (this *TestingReporter) Write(p []byte) (n int, err error)

type WriterReporter

type WriterReporter struct{ io.Writer }

func NewWriterReporter

func NewWriterReporter(writer io.Writer) *WriterReporter

func (*WriterReporter) Report

func (this *WriterReporter) Report(err error)

Jump to

Keyboard shortcuts

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