th

package
v0.1.1-debug1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package th provides basic test helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoConcurrently

func DoConcurrently(ff ...func())

func DoConcurrentlyN

func DoConcurrentlyN(n int, f func(i int))

func ExpectDrainedChan

func ExpectDrainedChan[A any](t *testing.T, ch <-chan A)

func ExpectError

func ExpectError(t *testing.T, err error, message string)

func ExpectNeverClosedChan

func ExpectNeverClosedChan[A any](t *testing.T, ch <-chan A, waitFor time.Duration)

func ExpectNoError

func ExpectNoError(t *testing.T, err error)

func ExpectNotHang

func ExpectNotHang(t *testing.T, waitFor time.Duration, f func())

func ExpectNotPanic

func ExpectNotPanic(t *testing.T, f func())

func ExpectSlice

func ExpectSlice[A comparable](t *testing.T, actual []A, expected []A)

func ExpectSorted

func ExpectSorted[T ordered](t *testing.T, arr []T)

func ExpectUnsorted

func ExpectUnsorted[T ordered](t *testing.T, arr []T)

func ExpectValue

func ExpectValue[A comparable](t *testing.T, actual A, expected A)

func ExpectValueGTE

func ExpectValueGTE[A number](t *testing.T, actual A, expected A)

func ExpectValueInDelta

func ExpectValueInDelta[A number](t *testing.T, actual A, expected A, delta A)

func ExpectValueLTE

func ExpectValueLTE[A number](t *testing.T, actual A, expected A)

func FromRange

func FromRange(start, end int) <-chan int

func FromSlice

func FromSlice[A any](slice []A) <-chan A

func Name

func Name(args ...any) string

Name generates a test name. Works the same way as fmt.Sprint, but adds spaces between all arguments.

func Send

func Send[T any](ch chan<- T, items ...T)

func Sort

func Sort[A ordered](s []A)

func TestBothOrderings

func TestBothOrderings(t *testing.T, f func(t *testing.T, ord bool))

func ToSlice

func ToSlice[A any](in <-chan A) []A

Types

type InProgressCounter

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

func (*InProgressCounter) Current

func (c *InProgressCounter) Current() int

func (*InProgressCounter) Dec

func (c *InProgressCounter) Dec()

func (*InProgressCounter) Inc

func (c *InProgressCounter) Inc()

func (*InProgressCounter) Max

func (c *InProgressCounter) Max() int

Jump to

Keyboard shortcuts

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