vegr

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Unlicense Imports: 5 Imported by: 0

Documentation

Overview

Package vegr (hel...vegr - the road to helheim) is a place to store library calls that hel mocks need in order to work. We put any non-trivial logic here so that it can have tests, and then allow hel mocks to import and use this properly-tested logic.

Since this is only intended for use by generated code, it eagerly panics for obviously incorrect usage.

Index

Constants

View Source
const (
	// MinVersion is the minimum version of hel that this library can work with.
	// Any version below v0.{MinVersion}.0 uses legacy code that is no longer
	// supported in this version of vegr.
	MinVersion = 0

	// MaxVersion is the maximum version of hel that this library can work with.
	// Any version above v0.{MaxVersion}.* may rely on new features in vegr that
	// don't exist in this version.
	MaxVersion = Version

	// Version is the current version of hel.
	Version = 6
)

Variables

This section is empty.

Functions

func BlockChan added in v0.5.0

func BlockChan() ret.Blocker

BlockChan initializes a channel for use when a method may want to block a return.

func PopulateReturns

func PopulateReturns(t TestingT, name string, timeout time.Duration, mock any, addrs ...any)

PopulateReturns handles populating return value addresses with values from channels in a mock.

Types

type EnforceVersion added in v0.6.0

type EnforceVersion uint

EnforceVersion is used by generated code to ensure that runtime code supports the version of the generated code. It relies on uint underflow to break if the version of hel that it was generated with is not supported by the imported version of this library.

The runtime can be updated with:

go get -u git.sr.ht/~nelsam/hel

The generated code can be updated with:

hel

Credit goes to github.com/protocol-buffers/protobuf-go for this idea.

type T

type T = TestingT

T is the old name of TestingT. We changed it after generics were added due to the common use of T as a generic type parameter.

It will remain for backward compatibility with previously generated code until the next 0.x.0 release.

type TestingT added in v0.6.5

type TestingT interface {
	Helper()
	Failed() bool
	Logf(string, ...any)
	Fatalf(string, ...any)
	Cleanup(func())
}

TestingT represents the properties of *testing.T that vegr uses.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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