testing

package
v0.0.0-...-ef924d7 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2016 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package testing is an extension to the standard go testing package tailored for testing the lego framework.

This package should solely be used by test packages.

Index

Constants

View Source
const (
	// T is the TRACE log constant
	TC = "TRACE"
	// W is the WARNING log constant
	WN = "WARN"
	// E is the ERROR log constant
	ER = "ERRR"
)

Variables

This section is empty.

Functions

func DidPanic

func DidPanic(f func()) (bool, interface{})

DidPanic returns whether the given function panicked

func NewLogger

func NewLogger(t *testing.T) log.Logger

NewLogger creates a new logger

func NewStats

func NewStats(t *testing.T) stats.Stats

NewStats creates a new stats

Types

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger is a simple Logger interface useful for tests

func (*Logger) Error

func (l *Logger) Error(args ...interface{})

func (*Logger) Errorf

func (l *Logger) Errorf(f string, args ...interface{})

func (*Logger) Errorln

func (l *Logger) Errorln(args ...interface{})

func (*Logger) Lines

func (l *Logger) Lines(s string) int

Lines returns the number of log lines for the given severity

func (*Logger) Trace

func (l *Logger) Trace(args ...interface{})

func (*Logger) Tracef

func (l *Logger) Tracef(f string, args ...interface{})

func (*Logger) Traceln

func (l *Logger) Traceln(args ...interface{})

func (*Logger) Warning

func (l *Logger) Warning(args ...interface{})

func (*Logger) Warningf

func (l *Logger) Warningf(f string, args ...interface{})

func (*Logger) Warningln

func (l *Logger) Warningln(args ...interface{})

type Stats

type Stats struct {
	// contains filtered or unexported fields
}

Stats is a simple Stats interface useful for tests

func (*Stats) Add

func (s *Stats) Add(metric *stats.Metric)

func (*Stats) SetLogger

func (s *Stats) SetLogger(l log.Logger)

func (*Stats) Start

func (s *Stats) Start()

func (*Stats) Stop

func (s *Stats) Stop()

type T

type T struct {
	// contains filtered or unexported fields
}

T is a wrapper of go standard testing.T It adds a few additional functions useful to lego

func New

func New(t *testing.T) *T

New returns a new instance of T

func (*T) Config

func (t *T) Config() *config.Config

Config returns an empty lego config

func (*T) Error

func (t *T) Error(args ...interface{})

Standard go testing.T functions

func (*T) Errorf

func (t *T) Errorf(format string, args ...interface{})

func (*T) Fail

func (t *T) Fail()

func (*T) FailNow

func (t *T) FailNow()

func (*T) Failed

func (t *T) Failed()

func (*T) Fatal

func (t *T) Fatal(args ...interface{})

func (*T) Fatalf

func (t *T) Fatalf(format string, args ...interface{})

func (*T) Log

func (t *T) Log(args ...interface{})

func (*T) Logf

func (t *T) Logf(format string, args ...interface{})

func (*T) Logger

func (t *T) Logger() log.Logger

Logger returns a lego logger interface

func (*T) NewAppCtx

func (t *T) NewAppCtx(name string) app.Ctx

Logger returns a lego logger interface

func (*T) Parallel

func (t *T) Parallel()

func (*T) Skip

func (t *T) Skip(args ...interface{})

func (*T) SkipNow

func (t *T) SkipNow()

func (*T) Skipf

func (t *T) Skipf(format string, args ...interface{})

func (*T) Skipped

func (t *T) Skipped()

func (*T) Stats

func (t *T) Stats() stats.Stats

Stats returns a lego stats interface

Jump to

Keyboard shortcuts

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