PathrockNetwork Gno Explorer
HomeBlocksTransactionsTokensRealmsPackagesValidatorsAnalytics

PathrockNetwork Gno Explorer — an independent explorer for Gno.land Mainnet (gnoland-1), operated by PathrockNetwork. Not an official Gno.land service.

gnowebarchive RPC

gno.land/p/nt/urequire/v0

Package
Open in gnoweb ↗

Overview

Kind
Pure package
Name
v0
Namespace
nt / urequire
Files
5 (README)(gnomod.toml)
Exported functions
n/a — not supported for pure packages by the node (vm/qfuncs)
Module
gno.land/p/nt/urequire/v0
gno
0.9

Files (5)

  • README.mdmarkdown
  • gnomod.tomltoml
  • doc.gnogno
  • urequire.gnogno
  • urequire_test.gnogno
urequire.gnogno
1// urequire is a sister package for uassert.2// XXX: codegen the package.3package urequire45import "gno.land/p/nt/uassert/v0"67// type TestingT = uassert.TestingT // XXX: bug, should work89// NoError requires that a function returned no error (i.e. `nil`).10func NoError(t uassert.TestingT, err error, msgs ...string) {11	t.Helper()12	if uassert.NoError(t, err, msgs...) {13		return14	}15	t.FailNow()16}1718// Error requires that a function returned an error (i.e. not `nil`).19func Error(t uassert.TestingT, err error, msgs ...string) {20	t.Helper()21	if uassert.Error(t, err, msgs...) {22		return23	}24	t.FailNow()25}2627// ErrorContains requires that a function returned an error (i.e. not `nil`)28// and that the error contains the specified substring.29func ErrorContains(t uassert.TestingT, err error, contains string, msgs ...string) {30	t.Helper()31	if uassert.ErrorContains(t, err, contains, msgs...) {32		return33	}34	t.FailNow()35}3637// True requires that the specified value is true.38func True(t uassert.TestingT, value bool, msgs ...string) {39	t.Helper()40	if uassert.True(t, value, msgs...) {41		return42	}43	t.FailNow()44}4546// False requires that the specified value is false.47func False(t uassert.TestingT, value bool, msgs ...string) {48	t.Helper()49	if uassert.False(t, value, msgs...) {50		return51	}52	t.FailNow()53}5455// ErrorIs requires that the given error matches the target error.56func ErrorIs(t uassert.TestingT, err, target error, msgs ...string) {57	t.Helper()58	if uassert.ErrorIs(t, err, target, msgs...) {59		return60	}61	t.FailNow()62}6364// AbortsWithMessage requires that the code inside the specified func aborts65// (panics when crossing another realm).66// Use PanicsWithMessage for requiring local panics within the same realm.67// Note: This relies on gno's `revive` mechanism to catch aborts.68// See uassert.AbortsWithMessage for `rlm` semantics.69func AbortsWithMessage(t uassert.TestingT, rlm realm, msg string, f any, msgs ...string) {70	t.Helper()71	if uassert.AbortsWithMessage(t, rlm, msg, f, msgs...) {72		return73	}74	t.FailNow()75}7677// AbortsContains requires that the code inside the specified func aborts78// (panics when crossing another realm) and the abort message contains the specified substring.79// See uassert.AbortsWithMessage for `rlm` semantics.80func AbortsContains(t uassert.TestingT, rlm realm, substr string, f any, msgs ...string) {81	t.Helper()82	if uassert.AbortsContains(t, rlm, substr, f, msgs...) {83		return84	}85	t.FailNow()86}8788// NotAborts requires that the code inside the specified func does NOT abort89// when crossing an execution boundary (e.g., VM call).90// Use NotPanics for requiring the absence of local panics within the same realm.91// Note: This relies on Gno's `revive` mechanism.92// See uassert.AbortsWithMessage for `rlm` semantics.93func NotAborts(t uassert.TestingT, rlm realm, f any, msgs ...string) {94	t.Helper()95	if uassert.NotAborts(t, rlm, f, msgs...) {96		return97	}98	t.FailNow()99}100101// PanicsWithMessage requires that the code inside the specified func panics102// locally within the same execution realm.103// Use AbortsWithMessage for requiring panics that cross execution boundaries (aborts).104// See uassert.AbortsWithMessage for `rlm` semantics.105func PanicsWithMessage(t uassert.TestingT, rlm realm, msg string, f any, msgs ...string) {106	t.Helper()107	if uassert.PanicsWithMessage(t, rlm, msg, f, msgs...) {108		return109	}110	t.FailNow()111}112113// PanicsContains requires that the code inside the specified func panics114// locally within the same execution realm and the panic message contains the specified substring.115// See uassert.AbortsWithMessage for `rlm` semantics.116func PanicsContains(t uassert.TestingT, rlm realm, substr string, f any, msgs ...string) {117	t.Helper()118	if uassert.PanicsContains(t, rlm, substr, f, msgs...) {119		return120	}121	t.FailNow()122}123124// NotPanics requires that the code inside the specified func does NOT panic125// locally within the same execution realm.126// Use NotAborts for requiring the absence of panics that cross execution boundaries (aborts).127// See uassert.AbortsWithMessage for `rlm` semantics.128func NotPanics(t uassert.TestingT, rlm realm, f any, msgs ...string) {129	t.Helper()130	if uassert.NotPanics(t, rlm, f, msgs...) {131		return132	}133	t.FailNow()134}135136// Equal requires that two objects are equal.137func Equal(t uassert.TestingT, expected, actual any, msgs ...string) {138	t.Helper()139	if uassert.Equal(t, expected, actual, msgs...) {140		return141	}142	t.FailNow()143}144145// NotEqual requires that two objects are not equal.146func NotEqual(t uassert.TestingT, expected, actual any, msgs ...string) {147	t.Helper()148	if uassert.NotEqual(t, expected, actual, msgs...) {149		return150	}151	t.FailNow()152}153154// Empty requires that the specified object is empty155// (zero value, empty string/slice/map, or nil).156func Empty(t uassert.TestingT, obj any, msgs ...string) {157	t.Helper()158	if uassert.Empty(t, obj, msgs...) {159		return160	}161	t.FailNow()162}163164// NotEmpty requires that the specified object is not empty.165func NotEmpty(t uassert.TestingT, obj any, msgs ...string) {166	t.Helper()167	if uassert.NotEmpty(t, obj, msgs...) {168		return169	}170	t.FailNow()171}172173// Nil requires that the value is nil.174func Nil(t uassert.TestingT, value any, msgs ...string) {175	t.Helper()176	if uassert.Nil(t, value, msgs...) {177		return178	}179	t.FailNow()180}181182// NotNil requires that the value is not nil.183func NotNil(t uassert.TestingT, value any, msgs ...string) {184	t.Helper()185	if uassert.NotNil(t, value, msgs...) {186		return187	}188	t.FailNow()189}190191// TypedNil requires that the value is a typed-nil (nil pointer) value.192func TypedNil(t uassert.TestingT, value any, msgs ...string) {193	t.Helper()194	if uassert.TypedNil(t, value, msgs...) {195		return196	}197	t.FailNow()198}199200// NotTypedNil requires that the value is not a typed-nil (nil pointer) value.201func NotTypedNil(t uassert.TestingT, value any, msgs ...string) {202	t.Helper()203	if uassert.NotTypedNil(t, value, msgs...) {204		return205	}206	t.FailNow()207}208

Functions

not supported for pure packages by the node (vm/qfuncs)

Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.