Documentation ¶
Overview ¶
Package tutil provides test utilities.
Index ¶
- func PrepRPCTestConfig(t *testing.T) *config.Config
- func RandomAddress() common.Address
- func RandomAvailablePort(t *testing.T) int
- func RandomBytes(l int) []byte
- func RandomHash() common.Hash
- func RandomListenAddress(t *testing.T) string
- func RequireGoldenBytes(t *testing.T, data []byte, opts ...func(*string))
- func RequireGoldenJSON(t *testing.T, data any, opts ...func(*string))
- func RequireNoError(tb testing.TB, err error)
- func TempDir(t *testing.T) string
- func WithFilename(name string) func(*string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrepRPCTestConfig ¶
PrepRPCTestConfig creates the require cometbft config on disk for rpctest package to work with halo app.
func RandomAddress ¶
RandomAddress returns a random 20-byte ethereum address.
func RandomAvailablePort ¶
func RandomBytes ¶
RandomBytes returns a random byte slice of length l.
func RandomListenAddress ¶
func RequireGoldenBytes ¶
RequireGoldenBytes asserts that a golden testdata file exists containing the exact data. This is heavily inspired from https://github.com/sebdah/goldie.
func RequireGoldenJSON ¶
RequireGoldenJSON asserts that a golden testdata file exists containing the JSON serialized form of the data object. This is heavily inspired from https://github.com/sebdah/goldie.
func RequireNoError ¶
RequireNoError asserts that err is nil. It also logs the error to show the stacktrace.
This can be used instead of require.NoError(t, err) to show the stacktrace in case of error.
func TempDir ¶
TempDir creates a temporary directory with a random name, as opposed to t.TempDir which uses consecutive numbers per test (001, 002 ...).
func WithFilename ¶
WithFilename configures a custom golden test filename.
Types ¶
This section is empty.