testutil

package
v0.0.0-...-76354a4 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	StdLogger = klog.NewNopLogger()

	LogExcludes  log.LoggerExcludes
	LoggerConfig log.Config
)
View Source
var TestDataFiles []string

Contains absolute file paths for the test data

Functions

func JsonDiff

func JsonDiff(expectedData string, parsedData string) (string, error)

func Log

func Log(vals ...interface{})

func LogDebug

func LogDebug(vals ...interface{})

func LogPass

func LogPass(name string)

func LogRun

func LogRun(name string)

func Logf

func Logf(s string, vals ...interface{})

func SetDebug

func SetDebug()

SetDebug is typically called from the init() function in a test file. SetDebug parses debug flags passed to the test binary and also sets the template for logging output.

func TestPathFromName

func TestPathFromName(name string) string

TestPathFromName loops through TestDataFiles until name is matched.

func TestPathsFromDirectory

func TestPathsFromDirectory(dir string) ([]string, error)

testPathsFromDirectory walks through the file tree in the testdata directory containing all of the tests and returns a string slice of all the discovered paths.

Types

type Test

type Test struct {
	Path            string // The path including directory and basename
	Data            string // The input data to be parsed
	ExpectItemData  string // The expected lex items output in json
	ExpectParseData string // The expected parse nodes in json
}

Contains a single test with data loaded from test files in the testdata directory

Jump to

Keyboard shortcuts

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