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/g17khqpukees4237dtn3astzapmp462vjhsz6st4/expect

Package
Open in gnoweb ↗

Overview

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

Files (13)

  • README.mdmarkdown
  • gnomod.tomltoml
  • boolean.gnogno
  • context.gnogno
  • doc.gnogno
  • error.gnogno
  • float.gnogno
  • func.gnogno
  • int.gnogno
  • message.gnogno
  • string.gnogno
  • uint.gnogno
  • value.gnogno
  • error.gnogno
    1package expect23import "gno.land/p/nt/ufmt/v0"45// NewErrorChecker creates a new checker of errors.6func NewErrorChecker(ctx Context, err error) ErrorChecker {7	return ErrorChecker{ctx, err}8}910// ErrorChecker asserts error values.11type ErrorChecker struct {12	ctx Context13	err error14}1516// Not negates the next called expectation.17func (c ErrorChecker) Not() ErrorChecker {18	c.ctx.negated = !c.ctx.negated19	return c20}2122// WithMessage asserts that current error contains an expected message.23func (c ErrorChecker) WithMessage(msg string) {24	c.ctx.T().Helper()2526	if c.err == nil {27		c.ctx.Fail("Expected an error with message\nGot: nil\nWant: %s", msg)28		return29	}3031	NewMessageChecker(c.ctx, c.err.Error(), MessageTypeError).WithMessage(msg)32}3334// WithError asserts that current error message is the same as an expected error.35func (c ErrorChecker) WithError(err error) {36	c.ctx.T().Helper()3738	if c.err == nil {39		if err != nil {40			c.ctx.Fail("Expected an error\nGot: nil\nWant: %s", err.Error())41		}42		return43	}4445	got := c.err.Error()46	c.ctx.CheckExpectation(got == err.Error(), func(ctx Context) string {47		if !ctx.IsNegated() {48			return ufmt.Sprintf("Expected errors to match\nGot: %s\nWant: %s", got, err.Error())49		}50		return ufmt.Sprintf("Expected errors to be different\nGot: %s", got)51	})52}53

    Functions

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

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