Documentation
¶
Overview ¶
Package testutils contains general utilities for testing to help ensure consistency in output style.
Index ¶
- func AssertAnyErrorInChainMatchesTarget(t *testing.T, target error, actual error)
- func AssertBigIntNonZero(t *testing.T, description string, actual *big.Int)
- func AssertBigIntsEqual(t *testing.T, description string, expected *big.Int, actual *big.Int)
- func AssertBigIntsNotEqual(t *testing.T, description string, a *big.Int, b *big.Int)
- func AssertBoolsEqual(t *testing.T, description string, expected bool, actual bool)
- func AssertBytesEqual(t *testing.T, expectedBytes []byte, actualBytes []byte)
- func AssertErrorsSame(t *testing.T, expected error, actual error)
- func AssertIntsEqual(t *testing.T, description string, expected int, actual int)
- func AssertStringsEqual(t *testing.T, description string, expected string, actual string)
- func AssertUintsEqual(t *testing.T, description string, expected uint64, actual uint64)
- func NewRandInt(currentValue, max *big.Int) *big.Int
- type MockLogger
- func (ml *MockLogger) Debug(args ...interface{})
- func (ml *MockLogger) Debugf(format string, args ...interface{})
- func (ml *MockLogger) Error(args ...interface{})
- func (ml *MockLogger) Errorf(format string, args ...interface{})
- func (ml *MockLogger) Fatal(args ...interface{})
- func (ml *MockLogger) Fatalf(format string, args ...interface{})
- func (ml *MockLogger) Info(args ...interface{})
- func (ml *MockLogger) Infof(format string, args ...interface{})
- func (ml *MockLogger) Panic(args ...interface{})
- func (ml *MockLogger) Panicf(format string, args ...interface{})
- func (ml *MockLogger) Warn(args ...interface{})
- func (ml *MockLogger) Warnf(format string, args ...interface{})
- func (ml *MockLogger) Warning(args ...interface{})
- func (ml *MockLogger) Warningf(format string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertAnyErrorInChainMatchesTarget ¶
AssertAnyErrorInChainMatchesTarget checks if any error in the error chain matches the target. If not, it reports a test failure.
func AssertBigIntNonZero ¶
AssertBigIntNonZero checks if the provided not-nil big integer is non-zero. If the provided big integer is zero, it reports a test failure.
func AssertBigIntsEqual ¶
AssertBigIntsEqual checks if two not-nil big integers are equal. If not, it reports a test failure.
func AssertBigIntsNotEqual ¶
AssertBigIntsNotEqual checks if two not-nil big integers are not equal. If they are equal, reports a test failure.
func AssertBoolsEqual ¶
AssertBoolsEqual checks if two booleans are equal. If not, it reports a test failure.
func AssertBytesEqual ¶
AssertBytesEqual checks if the two bytes array are equal. If not, it reports a test failure.
func AssertErrorsSame ¶
AssertErrorsSame checks if two errors are the same error. If not, it reports a test failure. Note that this function doesn't check errors deep equality but just checks whether both arguments point to the same underlying instance.
func AssertIntsEqual ¶
AssertIntsEqual checks if two integers are equal. If not, it reports a test failure.
func AssertStringsEqual ¶
AssertStringsEqual checks if two strings are equal. If not, it reports a test failure.
func AssertUintsEqual ¶
AssertUintsEqual checks if two unsigned integers are equal. If not, it reports a test failure.
Types ¶
type MockLogger ¶
type MockLogger struct{}
func (*MockLogger) Debug ¶
func (ml *MockLogger) Debug(args ...interface{})
func (*MockLogger) Debugf ¶
func (ml *MockLogger) Debugf(format string, args ...interface{})
func (*MockLogger) Error ¶
func (ml *MockLogger) Error(args ...interface{})
func (*MockLogger) Errorf ¶
func (ml *MockLogger) Errorf(format string, args ...interface{})
func (*MockLogger) Fatal ¶
func (ml *MockLogger) Fatal(args ...interface{})
func (*MockLogger) Fatalf ¶
func (ml *MockLogger) Fatalf(format string, args ...interface{})
func (*MockLogger) Info ¶
func (ml *MockLogger) Info(args ...interface{})
func (*MockLogger) Infof ¶
func (ml *MockLogger) Infof(format string, args ...interface{})
func (*MockLogger) Panic ¶
func (ml *MockLogger) Panic(args ...interface{})
func (*MockLogger) Panicf ¶
func (ml *MockLogger) Panicf(format string, args ...interface{})
func (*MockLogger) Warn ¶
func (ml *MockLogger) Warn(args ...interface{})
func (*MockLogger) Warnf ¶
func (ml *MockLogger) Warnf(format string, args ...interface{})
func (*MockLogger) Warning ¶
func (ml *MockLogger) Warning(args ...interface{})
func (*MockLogger) Warningf ¶
func (ml *MockLogger) Warningf(format string, args ...interface{})