testutil

package
v0.10.5 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2022 License: Unlicense Imports: 6 Imported by: 0

Documentation

Overview

Package testutil contains utilities for common testing patterns.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertErrorMsg

func AssertErrorMsg(t testing.TB, msg string, err error) (ok bool)

AssertErrorMsg asserts that the error is not nil and that its message is equal to msg. If msg is an empty string, AssertErrorMsg asserts that the error is nil instead.

func AssertMarshalText

func AssertMarshalText(t testing.TB, s string, v encoding.TextMarshaler) (ok bool)

AssertMarshalText checks that the implementation of v's MarshalText works in all situations and results in the string s. v must be a pointer.

See https://github.com/dominikh/go-tools/issues/911.

func AssertUnmarshalText

func AssertUnmarshalText(t testing.TB, s string, v encoding.TextUnmarshaler) (ok bool)

AssertUnmarshalText checks that the implementation of v's UnmarshalText works in all situations and results in a value deeply equal to want.

func CleanupAndRequireSuccess

func CleanupAndRequireSuccess(t testing.TB, f func() (err error))

CleanupAndRequireSuccess sets a cleanup function which checks the error returned by f and fails the test using t if there is one.

Types

This section is empty.

Jump to

Keyboard shortcuts

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