testify

package module
v1.0.0-rc.5 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package testify lets you use all expectto/be matchers with the testify/assert and testify/require packages.

It lives in its own module (github.com/expectto/be/x/testify) so the core `be` module never depends on testify. The be matchers use gomega internally as their matching engine, but that is an implementation detail: this adapter never exposes gomega's API, and it reshapes gomega's vertical, type-tagged failure messages into compact, testify-native one-liners (see internal/beformat).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assert

func Assert(t *testing.T, actual any, matcher types.BeMatcher, msgAndArgs ...any) bool

Assert uses a BeMatcher to assert that the actual value passes the matcher. It returns true if the match succeeds; otherwise, it fails the test using testify's assert.

func Mock

func Mock(matcher types.BeMatcher) any

Mock adapts a be matcher into a testify/mock argument matcher, so be matchers can match mock call arguments. It works with hand-written testify mocks and mockery-generated mocks alike:

svc.On("Do", betestify.Mock(be_math.GreaterThan(10))).Return("ok")

func Require

func Require(t *testing.T, actual any, matcher types.BeMatcher, msgAndArgs ...any)

Require asserts that the actual value passes the matcher. It fails the test immediately using testify's require package if the match fails.

Types

This section is empty.

Jump to

Keyboard shortcuts

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