assert

package
v3.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

A wrapper around *testing.T. I hate the if a != b { t.ErrorF(....) } pattern. Packages should prefer using the tests package (which exposes all of these functions). The only reason to use this package directly is if the tests package depends on your package (and thus you have a cyclical dependency)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoesNotContain

func DoesNotContain[T comparable](t *testing.T, haystack []T, needle T)

needle not in []haystack

func Equal

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

a == b

func Error

func Error(t *testing.T, actual error, expected error)

func False

func False(t *testing.T, actual bool)

A value is false

func List

func List[T comparable](t *testing.T, actuals []T, expecteds []T)

Two lists are equal (same length & same values in the same order)

func Nil

func Nil(t *testing.T, actual interface{})

A value is nil

func NotNil

func NotNil(t *testing.T, actual interface{})

A value is not nil

func Nowish

func Nowish(t *testing.T, actual time.Time)

func StringContains

func StringContains(t *testing.T, actual string, expected string)

The string contains the given value

func True

func True(t *testing.T, actual bool)

A value is true

Types

This section is empty.

Jump to

Keyboard shortcuts

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