assert

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Assertion Helpers

Because this is a library, we prefer to have no dependencies including our usual test dependencies (e.g. testify require). So we have some basic assertion helpers for tests.

See: https://github.com/benbjohnson/testing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assert

func Assert(tb testing.TB, condition bool, msg string, v ...interface{})

Assert fails the test if the condition is false.

func Equals

func Equals(tb testing.TB, exp, act interface{})

Equals fails the test if exp (expected) is not equal to act (actual).

func ErrorIs

func ErrorIs(tb testing.TB, err, target error)

ErrorIs fails the test if the err does not match the target.

func False

func False(tb testing.TB, condition bool)

False asserts that the condition is false.

func Ok

func Ok(tb testing.TB, err error)

Ok fails the test if an err is not nil.

func True

func True(tb testing.TB, condition bool)

True asserts that the condition is true.

Types

type BoolAssertion

type BoolAssertion func(testing.TB, bool)

Jump to

Keyboard shortcuts

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