test

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package test contains defaults and helpers for unit tests in vidar.

Index

Constants

View Source
const (
	Timeout     = time.Second
	MockTimeout = 5 * time.Second
)

Variables

This section is empty.

Functions

func Context added in v0.6.0

func Context(t T) context.Context

Context creates a context with the default test timeout. It sets the cancel func to occur on t.Cleanup.

func NewExpect added in v0.6.0

func NewExpect(t *testing.T) expect.Expectation

NewExpect returns a new expect.Expectation with custom color differs set.

Types

type BeErrMatcher added in v0.6.0

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

BeErrMatcher matches errors with errors.Is.

func BeErr added in v0.6.0

func BeErr(err error) *BeErrMatcher

BeErr returns a matcher that matches err using errors.Is.

func (*BeErrMatcher) Match added in v0.6.0

func (b *BeErrMatcher) Match(actual any) (any, error)

Match matches actual against the error b was constructed with.

type T added in v0.6.0

type T interface {
	zerolog.TestingLog
	Cleanup(func())
}

T represents the methods we need from testing types.

Jump to

Keyboard shortcuts

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