test

package
v0.2.2-alpha Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: Apache-2.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger struct {
	T *testing.T
	// contains filtered or unexported fields
}

Logger is a simple, yet thread-safe, logger intended for use in unit tests.

func NewLogger

func NewLogger(t *testing.T) *Logger

NewLogger create a Logger that outputs data using given testing.T instance.

func (*Logger) Debug

func (t *Logger) Debug(msg string, keyvals ...interface{})

Debug prints a debug message.

func (*Logger) Error

func (t *Logger) Error(msg string, keyvals ...interface{})

Error prints an error message.

func (*Logger) Info

func (t *Logger) Info(msg string, keyvals ...interface{})

Info prints an info message.

type MockLogger

type MockLogger struct {
	DebugLines, InfoLines, ErrLines []string
}

MockLogger is a fake logger that accumulates all the inputs.

It can be used in tests to ensure that certain messages was logged with correct severity.

func (*MockLogger) Debug

func (t *MockLogger) Debug(msg string, keyvals ...interface{})

Debug saves a debug message.

func (*MockLogger) Error

func (t *MockLogger) Error(msg string, keyvals ...interface{})

Error saves an error message.

func (*MockLogger) Info

func (t *MockLogger) Info(msg string, keyvals ...interface{})

Info saves an info message.

Jump to

Keyboard shortcuts

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