testing

package
v2.9.3+incompatible Latest Latest
Warning

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

Go to latest
Published: May 23, 2018 License: MIT Imports: 12 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 GetLogger

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

func GetRedisClient

func GetRedisClient() *redis.Client

GetRedisClient returns a redis client that can be used for testing

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.

type WaitGroup

type WaitGroup struct {
	sync.WaitGroup
}

WaitGroup is an extension of sync.WaitGroup with a WaitFor function for testing

func (*WaitGroup) WaitFor

func (wg *WaitGroup) WaitFor(d time.Duration) error

WaitFor waits for the specified duration

Jump to

Keyboard shortcuts

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