Documentation ¶
Index ¶
- Constants
- func CompareBox(exp packd.Walkable, res genny.Results) error
- func CompareBoxStripped(exp packd.Walkable, res genny.Results) error
- func CompareCommands(exp []string, act []*exec.Cmd) error
- func CompareFiles(exp []string, act []genny.File) error
- func NewRunner() *genny.Runner
- func Run(g *genny.Generator) (genny.Results, error)
- func RunGroup(gg *genny.Group) (genny.Results, error)
- func RunNew(g *genny.Generator, err error) (genny.Results, error)
- type Logger
- func (l *Logger) Close() error
- func (l *Logger) Debug(args ...interface{})
- func (l *Logger) Debugf(s string, args ...interface{})
- func (l *Logger) Error(args ...interface{})
- func (l *Logger) Errorf(s string, args ...interface{})
- func (l *Logger) Fatal(args ...interface{})
- func (l *Logger) Fatalf(s string, args ...interface{})
- func (l *Logger) Info(args ...interface{})
- func (l *Logger) Infof(s string, args ...interface{})
- func (l *Logger) Panic(args ...interface{})
- func (l *Logger) Panicf(s string, args ...interface{})
- func (l *Logger) Print(args ...interface{})
- func (l *Logger) Printf(s string, args ...interface{})
- func (l *Logger) Warn(args ...interface{})
- func (l *Logger) Warnf(s string, args ...interface{})
Constants ¶
const ( DEBUG string = "DEBU" INFO = "INFO" WARN = "WARN" ERROR = "ERRO" FATAL = "FATA" PANIC = "PANI" PRINT = "PRIN" )
Variables ¶
This section is empty.
Functions ¶
func CompareBox ¶
CompareBox compares a packd.Walkable box of files (usually fixtures) the results of a genny.Runner
func CompareBoxStripped ¶
CompareBoxStripped compares a packd.Walkable box of files (usually fixtures) the results of a genny.Runner by removing any whitespaces, tabs, or newlines.
func CompareCommands ¶
CompareCommands asserts that the expected commands match the actual commands executed. The expected commands should be the commands, with arguments, as you would type them on the command line. In typical usage, the actual commands can be extracted from a genny#Generator.Results under the Commands key
func CompareFiles ¶
CompareFiles compares a slice of expected filenames to a slice of genny.Files. Expected files can be listed in any order. An excellent choice for the actual files can be found in genny#Generator.Results under the Files attribute
Types ¶
type Logger ¶
type Logger struct { // Stream contains the raw byte stream from all logging activity. This is // useful for output with testing.(*T).Log in concert with checking for // testing.Verbose() Stream *bytes.Buffer // Log contains all log messages, categorized by log level. The keys of this // map are the log levels found in the const definitions. Log map[string][]string // PrintFn is an optional func which will be invoked with all log messages // when they are emitted PrintFn func(...interface{}) // CloseFn is an optional cleanup function invoked at the end of the runner's // execution CloseFn func() error // contains filtered or unexported fields }
Logger is a repository of log messages emitted by Generators suitable for examination in tests.
func (*Logger) Close ¶
Close is invoked at the end of a genny#Runner's execution. It will invoke a CloseFn if set.
func (*Logger) Debug ¶
func (l *Logger) Debug(args ...interface{})
Debug combines a variadic number of strings into a single debug log message
func (*Logger) Debugf ¶
Debugf processes a format string and produces a debug message to the test logger
func (*Logger) Error ¶
func (l *Logger) Error(args ...interface{})
Error logs a message formed by combining the arguments into a single string at the Error level
func (*Logger) Errorf ¶
Errorf logs the provided string at the warning level. Prior to logging, the string is processed as a format string against the provided arguments
func (*Logger) Fatal ¶
func (l *Logger) Fatal(args ...interface{})
Fatal logs a message formed by combining the arguments into a single string at the Fatal level
func (*Logger) Fatalf ¶
Fatalf logs the provided string at the Fatal level. Prior to logging, the string is processed as a format string against the provided arguments
func (*Logger) Info ¶
func (l *Logger) Info(args ...interface{})
Info combines a variadic number of strings into a log message at the Info level.
func (*Logger) Panic ¶
func (l *Logger) Panic(args ...interface{})
Panic logs a message formed by combining the arguments into a single string at the Panic level
func (*Logger) Panicf ¶
Panicf logs the provided string at the Panic level. Prior to logging, the string is processed as a format string against the provided arguments
func (*Logger) Print ¶
func (l *Logger) Print(args ...interface{})
Print logs messages at the Print level after combining all arguments into a single string
func (*Logger) Printf ¶
Printf logs messages at the Print level after processing the string and its arguments as a format string