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
- func DidPanic(f func()) (bool, interface{})
- func NewLogger(t *testing.T, strict bool) log.Logger
- func NewStats(t *testing.T) stats.Stats
- func NextPort() int
- type Logger
- func (l *Logger) AddCalldepth(n int) log.Logger
- func (l *Logger) Error(tag, msg string, fields ...log.Field)
- func (l *Logger) Lines(s string) int
- func (l *Logger) Trace(tag, msg string, fields ...log.Field)
- func (l *Logger) Warning(tag, msg string, fields ...log.Field)
- func (l *Logger) With(fields ...log.Field) log.Logger
- type Stats
- func (s *Stats) Count(key string, n interface{}, meta ...map[string]string)
- func (s *Stats) Dec(key string, meta ...map[string]string)
- func (s *Stats) Gauge(key string, n interface{}, meta ...map[string]string)
- func (s *Stats) Histogram(key string, n interface{}, meta ...map[string]string)
- func (s *Stats) Inc(key string, meta ...map[string]string)
- func (s *Stats) SetLogger(l log.Logger)
- func (s *Stats) Start()
- func (s *Stats) Stop()
- func (s *Stats) Timing(key string, d time.Duration, meta ...map[string]string)
- type StatsOp
- type StatsPoint
- type T
- func (t *T) Config() *config.Config
- func (t *T) DisableStrictMode()
- func (t *T) Error(args ...interface{})
- func (t *T) Errorf(format string, args ...interface{})
- func (t *T) Fail()
- func (t *T) FailNow()
- func (t *T) Failed()
- func (t *T) Fatal(args ...interface{})
- func (t *T) Fatalf(format string, args ...interface{})
- func (t *T) Log(args ...interface{})
- func (t *T) Logf(format string, args ...interface{})
- func (t *T) Logger() log.Logger
- func (t *T) NewAppCtx(name string) app.Ctx
- func (t *T) Parallel()
- func (t *T) Skip(args ...interface{})
- func (t *T) SkipNow()
- func (t *T) Skipf(format string, args ...interface{})
- func (t *T) Skipped()
- func (t *T) Stats() stats.Stats
Constants ¶
View Source
const ( // TC is the TRACE log constant TC = "TRACE" // WN is the WARNING log constant WN = "WARN" // ER is the ERROR log constant ER = "ERRR" )
View Source
const ( OpCount = iota OpInc OpDec OpGauge OpTiming OpHistogram )
Variables ¶
This section is empty.
Functions ¶
func DidPanic ¶
func DidPanic(f func()) (bool, interface{})
DidPanic returns whether the given function panicked
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is a simple Logger interface useful for tests
type Stats ¶
type Stats struct { Data map[string][]StatsPoint // contains filtered or unexported fields }
Stats is a simple Stats interface useful for tests
type StatsOp ¶
type StatsOp int
StatsOp an operation, such as count, gauge, timing sent to the testing stats
type StatsPoint ¶
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 (*T) DisableStrictMode ¶ added in v0.1.0
func (t *T) DisableStrictMode()
DisableStrictMode will stop making error logs failing a test
Click to show internal directories.
Click to hide internal directories.