assert

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2022 License: MIT Imports: 9 Imported by: 0

README

A thin wrapper around Go's testing.T to reduce some repetition as well as providing some common testing helpers (like asserting that a timestamp is "now").

Documentation

Overview

A wrapper around *testing.T. I hate the if a != b { t.ErrorF(....) } pattern.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(t *testing.T, actual []byte, expected []byte)

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 Fail

func Fail(t *testing.T, fmt string, args ...interface{})

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 any)

A value is nil

func NotEqual

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

a != b

func NotNil

func NotNil(t *testing.T, actual any)

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 Timeish

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

func True

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

A value is true

func Validation

func Validation(t *testing.T, result any) *v

Types

This section is empty.

Jump to

Keyboard shortcuts

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