genny: github.com/gobuffalo/genny/gentest Index | Files

package gentest

import "github.com/gobuffalo/genny/gentest"

Index

Package Files

commands.go files.go logger.go runner.go

Constants

const (
    DEBUG string = "DEBU"
    INFO         = "INFO"
    WARN         = "WARN"
    ERROR        = "ERRO"
    FATAL        = "FATA"
    PANIC        = "PANI"
    PRINT        = "PRIN"
)

func CompareBox Uses

func CompareBox(exp packd.Walkable, res genny.Results) error

CompareBox compares a packd.Walkable box of files (usually fixtures) the results of a genny.Runner

func CompareBoxStripped Uses

func CompareBoxStripped(exp packd.Walkable, res genny.Results) error

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 Uses

func CompareCommands(exp []string, act []*exec.Cmd) error

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 Uses

func CompareFiles(exp []string, act []genny.File) error

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

func NewRunner Uses

func NewRunner() *genny.Runner

NewRunner is a dry runner with gentest.NewLogger()

func Run Uses

func Run(g *genny.Generator) (genny.Results, error)

Run executes the generator and returns results or an error

func RunGroup Uses

func RunGroup(gg *genny.Group) (genny.Results, error)

RunGroup runs the group and returns results or an error

func RunNew Uses

func RunNew(g *genny.Generator, err error) (genny.Results, error)

RunNew executes the generator and returns results or an error

type Logger Uses

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 NewLogger Uses

func NewLogger() *Logger

NewLogger produces an initialized Logger

func (*Logger) Close Uses

func (l *Logger) Close() error

Close is invoked at the end of a genny#Runner's execution. It will invoke a CloseFn if set.

func (*Logger) Debug Uses

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

Debug combines a variadic number of strings into a single debug log message

func (*Logger) Debugf Uses

func (l *Logger) Debugf(s string, args ...interface{})

Debugf processes a format string and produces a debug message to the test logger

func (*Logger) Error Uses

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 Uses

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

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 Uses

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 Uses

func (l *Logger) Fatalf(s string, args ...interface{})

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 Uses

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

Info combines a variadic number of strings into a log message at the Info level.

func (*Logger) Infof Uses

func (l *Logger) Infof(s string, args ...interface{})

Infof processes a format string and produces a log message at the Info level

func (*Logger) Panic Uses

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 Uses

func (l *Logger) Panicf(s string, args ...interface{})

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 Uses

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

Print logs messages at the Print level after combining all arguments into a single string

func (*Logger) Printf Uses

func (l *Logger) Printf(s string, args ...interface{})

Printf logs messages at the Print level after processing the string and its arguments as a format string

func (*Logger) Warn Uses

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

Warn logs messages at the Warn level after combining the provided arguments into a single string

func (*Logger) Warnf Uses

func (l *Logger) Warnf(s string, args ...interface{})

Warnf logs messages at the Warn level after processing the string as a format string against the provided arguments

Package gentest imports 11 packages (graph). Updated 2019-04-07. Refresh now. Tools for package owners.