elpstest

package
v1.16.8 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertSortedMap added in v1.14.0

func AssertSortedMap(t *testing.T, m lisp.Map) bool

AssertSortedMap runs tests to ensure that m satisfies constraints required for sorted maps. The following properties are tested by AssertSortedMap:

The m.Keys and m.Entries produce lists with the expected length,
m.Len()

Repeated calls to m.Entries() return equal lists of pairs

Repeated calls to m.Keys() return equal lists

The lists returned by m.Keys() and m.Entries() have consistent elements
and order.

Calling m.Get() with a key from m.Entries() returns a value consistent
with that entry.

AssertSortedMap does not test any of the following properties:

Success/Failure of insertions or deletions -- m must already be
populated with values.

Restrictions the implementation places on the types of keys/values.

Any measure of correctness in the ordering of entries/keys.  The only
requirement is that the order be fixed for a given set of key-value
pairs.

func BenchmarkParse

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

func RunBenchmark added in v1.13.0

func RunBenchmark(b *testing.B, source string)

RunBenchmark runs a standard benchmark that executes expressions parsed from source.

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
}

Runner is a test runner.

func (*Runner) LispError

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

func (*Runner) LoadBenchmarks added in v1.13.0

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

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.TB) (*lisp.LEnv, error)

func (*Runner) RunBenchmark added in v1.13.0

func (r *Runner) RunBenchmark(b *testing.B, i int, path string, source io.Reader)

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

func (*Runner) RunBenchmarkFile added in v1.13.0

func (r *Runner) RunBenchmarkFile(b *testing.B, path string)

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