check

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

* This package provides "assertions" for use in [erltest.TestExpectation]s. * * # Why is this needed? * * testing.T.FailNow requires that it be called from the goroutine running the test. Since * an erl process is by definition not going to execute in the test goroutine, we need to provide * alternative functions that can be used. This is basically an inversion of gotest.tools/v3/assert, * but replacing everything with Checks/returning a bool.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assert

func Assert(t *testing.T, comparison assert.BoolOrComparison, msgAndArgs ...any) bool

accepts binary comparisons or booleans and returns the result

func Chain

func Chain(t *testing.T, checks ...bool) bool

returns false if any item in [checks] fails.

func Contains

func Contains(t *testing.T, collection any, item any, msgAndArgs ...any) bool

Works with finding an item in a collection OR a substring (uses strings.Contains under the hood)

func DeepEqual

func DeepEqual(t *testing.T, actual, expected any, opts ...gocmp.Option) bool

Compares two values using go-cmp/cmp

func Equal

func Equal(t *testing.T, actual, expected any, msgAndArgs ...any) bool

func Error

func Error(t *testing.T, e error, expected string, msgAndArgs ...any) bool

returns true if [e] is error and it's Error method matches [expected]

func ErrorContains

func ErrorContains(t *testing.T, e error, expected string, msgAndArgs ...any) bool

returns true if [e] is error and [expected] is a substring of [e.Error]

func ErrorIs

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

returns true if [e] is error and it matches the [expected] error

func Nil

func Nil(t *testing.T, ptr any, msgAndArgs ...any) bool

returns true if [ptr] is nil

func NilError

func NilError(t *testing.T, e error, msgAndArgs ...any) bool

returns true if error [e] is nil

Types

This section is empty.

Jump to

Keyboard shortcuts

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