affirm

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2025 License: MIT Imports: 4 Imported by: 0

README

Package affirm is an internal package that provides simple affirmation functions designed to improve readability and minimize boilerplate code in test cases by offering concise, semantically meaningful functions.

Documentation

Overview

Package affirm is an internal package that provides simple affirmation functions designed to improve readability and minimize boilerplate code in test cases by offering concise, semantically meaningful functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeepEqual

func DeepEqual(t core.T, want, have any) bool

DeepEqual affirms "want" and "have" are equal using reflect.DeepEqual. Returns true if it is, otherwise marks the test as failed, writes error message to the test log and returns false.

func Equal

func Equal[T comparable](t core.T, want, have T) bool

Equal affirms two comparable types are equal. Returns true if it is, otherwise marks the test as failed, writes error message to the test log and returns false.

func Nil

func Nil(t core.T, have any) bool

Nil affirms "have" is nil. Returns true if it is, otherwise marks the test as failed, writes error message to the test log and returns false.

func NotNil

func NotNil(t core.T, have any) bool

NotNil affirms "have" is not nil. Returns true if it is not, otherwise marks the test as failed, writes error message to the test log and returns false.

func Panic

func Panic(t core.T, fn func()) *string

Panic affirms "fn" panics. When "fn" panicked, it returns pointer to a string representation of the value used in panic(). When "fn" doesn't panic it returns nil, marks the test as failed and writes error message to the test.

Types

This section is empty.

Jump to

Keyboard shortcuts

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