testing

package
v0.0.0-...-9a529fd Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2017 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package testing offers some handy methods to display check and cross symbols with colors in test logs.

Index

Constants

This section is empty.

Variables

View Source
var Colors = [...]int{
	log.DebugLevel: gray,
	log.InfoLevel:  blue,
	log.WarnLevel:  yellow,
	log.ErrorLevel: red,
	log.FatalLevel: red,
}

Colors mapping.

View Source
var Strings = [...]string{
	log.DebugLevel: "DEBUG",
	log.InfoLevel:  "INFO",
	log.WarnLevel:  "WARN",
	log.ErrorLevel: "ERROR",
	log.FatalLevel: "FATAL",
}

Strings mapping.

Functions

func Check

func Check(t *testing.T, want, got interface{}, name string)

Check serves a for general comparison between two objects

func CheckErrors

func CheckErrors(t *testing.T, want *string, got error)

Check errors verify if a given string corresponds to a known error

func Desc

func Desc(t *testing.T, format string, a ...interface{})

Desc displays the provided description in cyan

func FatalUnless

func FatalUnless(t *testing.T, err error)

func GetLogger

func GetLogger(t *testing.T, tag string) log.Interface

func Ko

func Ko(t *testing.T, format string, a ...interface{})

Ko fails the test and display a red cross symbol

func NewResponseWriter

func NewResponseWriter() responseWriter

func Ok

func Ok(t *testing.T, tag string)

Ok displays a green check symbol

Types

type LogHandler

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

LogHandler implementation.

func NewLogHandler

func NewLogHandler(t *testing.T) *LogHandler

NewLogHandler handler.

func (*LogHandler) HandleLog

func (h *LogHandler) HandleLog(e *log.Entry) error

HandleLog implements log.Handler.

Jump to

Keyboard shortcuts

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