assert

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package assert provides a set of tools for use with the Go testing package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare[T any](t *testing.T, actual, expected T, opts ...cmp.Option)

Compare asserts that the expected value is equal to the actual value. Actual and expected need not be comparable.

func Contains

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

Contains asserts that the expected string is contained in the actual string.

func Equal

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

Equal asserts that the expected value is equal to the actual value. Actual and expected must be comparable. To compare non-comparable types use Compare.

func Error

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

Error asserts that the error string from err matches the expected.

func False

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

False asserts that the given value is false.

func IsError

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

IsError asserts that the actual error matches the expected error.

func MockExpectationsMet

func MockExpectationsMet(t *testing.T, mock sqlmock.Sqlmock)

MockExpectationsMet asserts that the expectations for the given mock were met.

func Nil

func Nil(t *testing.T, object any)

Nil asserts that the value of the given object is nil.

func NotEqual

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

NotEqual asserts that the expected value is not equal to the actual value. Actual and expected must be comparable. To compare non-comparable types use Compare.

func NotNil

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

NotNil asserts that the value of the given object is not nil.

func True

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

True asserts that the given 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