Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

v0 source pure

v0 - Unaudited: This is an initial version that has not yet been formally audited. A fully audited version will be pu...

Readme View source

v0 - Unaudited This is an initial version of this package that has not yet been formally audited. A fully audited version will be published as a subsequent release. Use in production at your own risk.

uassert

Package uassert provides assertion helpers for testing Gno packages and realms.

Overview

v0 - Unaudited: This is an initial version that has not yet been formally audited. A fully audited version will be published as a subsequent release. Use in production at your own risk.

uassert is an adapted lighter version of https://github.com/stretchr/testify/assert.

Functions 20

func AbortsContains

1func AbortsContains(t TestingT, rlm realm, substr string, f any, msgs ...string) bool
source

AbortsContains asserts that the code inside the specified func aborts (panics when crossing another realm) and the abort message contains the specified substring. See AbortsWithMessage for `rlm` semantics.

func AbortsWithMessage

1func AbortsWithMessage(t TestingT, rlm realm, msg string, f any, msgs ...string) bool
source

AbortsWithMessage asserts that the code inside the specified func aborts (panics when crossing another realm). Use PanicsWithMessage for asserting local panics within the same realm.

`rlm` is threaded into the callback via cross(rlm) when f is func(realm). It is ignored for func() callbacks. /p/ production code cannot declare crossing functions, so rlm is taken as the second (non-first) parameter — callers pass `cur` directly.

NOTE: This relies on gno's `revive` mechanism to catch aborts.

func Empty

1func Empty(t TestingT, obj any, msgs ...string) bool
source

func Equal

1func Equal(t TestingT, expected, actual any, msgs ...string) bool
source

Equal asserts that two objects are equal.

func Error

1func Error(t TestingT, err error, msgs ...string) bool
source

Error asserts that a function returned an error (i.e. not `nil`).

func ErrorContains

1func ErrorContains(t TestingT, err error, contains string, msgs ...string) bool
source

ErrorContains asserts that a function returned an error (i.e. not `nil`) and that the error contains the specified substring.

func ErrorIs

1func ErrorIs(t TestingT, err, target error, msgs ...string) bool
source

ErrorIs asserts the given error matches the target error using errors.Is, which traverses the error chain looking for a match.

func False

1func False(t TestingT, value bool, msgs ...string) bool
source

False asserts that the specified value is false.

func Nil

1func Nil(t TestingT, value any, msgs ...string) bool
source

Nil asserts that the value is nil.

func NoError

1func NoError(t TestingT, err error, msgs ...string) bool
source

NoError asserts that a function returned no error (i.e. `nil`).

func NotAborts

1func NotAborts(t TestingT, rlm realm, f any, msgs ...string) bool
source

NotAborts asserts that the code inside the specified func does NOT abort when crossing an execution boundary. Note: Consider using NotPanics which checks for both panics and aborts. See AbortsWithMessage for `rlm` semantics.

func NotEmpty

1func NotEmpty(t TestingT, obj any, msgs ...string) bool
source

func NotEqual

1func NotEqual(t TestingT, expected, actual any, msgs ...string) bool
source

NotEqual asserts that two objects are not equal.

func NotNil

1func NotNil(t TestingT, value any, msgs ...string) bool
source

NotNil asserts that the value is not nil.

func NotPanics

1func NotPanics(t TestingT, rlm realm, f any, msgs ...string) bool
source

NotPanics asserts that the code inside the specified func does NOT panic (within the same realm) or abort (due to a cross-realm panic). See AbortsWithMessage for `rlm` semantics.

func NotTypedNil

1func NotTypedNil(t TestingT, value any, msgs ...string) bool
source

NotTypedNil asserts that the value is not a typed-nil (nil pointer) value.

func PanicsContains

1func PanicsContains(t TestingT, rlm realm, substr string, f any, msgs ...string) bool
source

PanicsContains asserts that the code inside the specified func panics locally within the same execution realm and the panic message contains the specified substring. See AbortsWithMessage for `rlm` semantics.

func PanicsWithMessage

1func PanicsWithMessage(t TestingT, rlm realm, msg string, f any, msgs ...string) bool
source

PanicsWithMessage asserts that the code inside the specified func panics locally within the same execution realm. Use AbortsWithMessage for asserting panics that cross execution boundaries (aborts). See AbortsWithMessage for `rlm` semantics.

func True

1func True(t TestingT, value bool, msgs ...string) bool
source

True asserts that the specified value is true.

func TypedNil

1func TypedNil(t TestingT, value any, msgs ...string) bool
source

TypedNil asserts that the value is a typed-nil (nil pointer) value.

Types 1

type TestingT

interface
1type TestingT interface {
2	Helper()
3	Skip(args ...any)
4	Fatalf(fmt string, args ...any)
5	Errorf(fmt string, args ...any)
6	Logf(fmt string, args ...any)
7	Fail()
8	FailNow()
9}
source

Imports 5

Source Files 8