Documentation
¶
Index ¶
- func AssertMessagesEqual(t *testing.T, expected, actual *types.Message)
- func CreateTestError(t *testing.T, id types.ID, code int, message string) *types.Message
- func CreateTestMessage(t *testing.T, id *types.ID, method string, params interface{}) *types.Message
- func CreateTestResult(t *testing.T, id types.ID, result interface{}) *types.Message
- func ErrorsEqual(a, b *types.ErrorResponse) bool
- func IDsEqual(a, b *types.ID) bool
- func JSONDeepEqual(a, b interface{}) bool
- func JSONDeepEqualValue(a, b interface{}) bool
- func JSONEqual(t *testing.T, a, b *json.RawMessage) bool
- func MarshalResult(v interface{}) (*json.RawMessage, error)
- type TestLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertMessagesEqual ¶
AssertMessagesEqual compares two messages for equality
func CreateTestError ¶
CreateTestError creates a Message containing an error
func CreateTestMessage ¶
func CreateTestMessage(t *testing.T, id *types.ID, method string, params interface{}) *types.Message
CreateTestMessage creates a Message with the given fields
func CreateTestResult ¶
CreateTestResult creates a Message containing a result
func ErrorsEqual ¶
func ErrorsEqual(a, b *types.ErrorResponse) bool
ErrorsEqual compares two error responses for equality
func JSONDeepEqual ¶
func JSONDeepEqual(a, b interface{}) bool
JSONDeepEqual compares two JSON values for deep equality
func JSONDeepEqualValue ¶
func JSONDeepEqualValue(a, b interface{}) bool
JSONDeepEqualValue compares two JSON values for deep equality
func JSONEqual ¶
func JSONEqual(t *testing.T, a, b *json.RawMessage) bool
JSONEqual compares two JSON messages for equality
func MarshalResult ¶
func MarshalResult(v interface{}) (*json.RawMessage, error)
MarshalResult marshals the given result into a json.RawMessage
Types ¶
type TestLogger ¶
type TestLogger struct {
// contains filtered or unexported fields
}
TestLogger provides a thread-safe logging buffer for tests
func NewTestLogger ¶
func NewTestLogger(t *testing.T) *TestLogger
NewTestLogger creates a new TestLogger
func (*TestLogger) Logf ¶
func (l *TestLogger) Logf(format string, args ...interface{})
Logf writes a formatted log message to the buffer
func (*TestLogger) String ¶
func (l *TestLogger) String() string
String returns the current contents of the log buffer