elpstest

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2019 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BenchmarkParse

func BenchmarkParse(path string, r func() lisp.Reader) func(*testing.B)

func RunTestSuite

func RunTestSuite(t *testing.T, tests TestSuite)

RunTestSuite runs each TestSequence in tests on isolated lisp.LEnvs.

Types

type Logger

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

func NewLogger

func NewLogger(t testing.TB) *Logger

func (*Logger) Flush

func (log *Logger) Flush()

func (*Logger) Write

func (log *Logger) Write(b []byte) (int, error)

type Runner

type Runner struct {
	// Loader is the package loader used to initialize the test environment.
	// When Loader is nil lisplib.LoadLibrary is used.
	Loader func(*lisp.LEnv) *lisp.LVal

	// Teardown runs code to teardown an environment after each test declared
	// in the testing package has been run.  Any error returned by the teardown
	// function is reported as a test failure.
	Teardown func(*lisp.LEnv) *lisp.LVal
	// contains filtered or unexported fields
}

Runner is a test runner.

func (*Runner) LispError

func (r *Runner) LispError(t *testing.T, err error)

func (*Runner) LoadTests

func (r *Runner) LoadTests(t *testing.T, path string, source io.Reader) []string

func (*Runner) NewEnv

func (r *Runner) NewEnv(t *testing.T) (*lisp.LEnv, error)

func (*Runner) RunTest

func (r *Runner) RunTest(t *testing.T, i int, path string, source io.Reader)

RunTest runs the test at index i read from source. Path is only used to determine a file basename to use in LEnv.Load(). RunTest returns true if the test, and any teardown function given, completed successfully.

func (*Runner) RunTestFile

func (r *Runner) RunTestFile(t *testing.T, path string)

type TestSequence

type TestSequence []struct {
	Expr   string // a lisp expression
	Result string // the evaluated result
	Output string // debug output written to Runtime.Stderr
}

TestSequence is a sequence of lisp expressions which are evaluated sequentially by a lisp.LEnv.

type TestSuite

type TestSuite []struct {
	Name string
	TestSequence
}

TestSuite is a set of named TestSequences

Jump to

Keyboard shortcuts

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