Documentation
¶
Index ¶
- func AssertSortedMap(t *testing.T, m lisp.Map) bool
- func BenchmarkParse(path string, r func() lisp.Reader) func(*testing.B)
- func RunBenchmark(b *testing.B, source string)
- func RunTestSuite(t *testing.T, tests TestSuite)
- type Logger
- type Runner
- func (r *Runner) LispError(t testing.TB, err error)
- func (r *Runner) LoadBenchmarks(t *testing.B, path string, source io.Reader) []string
- func (r *Runner) LoadTests(t *testing.T, path string, source io.Reader) []string
- func (r *Runner) NewEnv(t testing.TB) (*lisp.LEnv, error)
- func (r *Runner) RunBenchmark(b *testing.B, i int, path string, source io.Reader)
- func (r *Runner) RunBenchmarkFile(b *testing.B, path string)
- func (r *Runner) RunTest(t *testing.T, i int, path string, source io.Reader)
- func (r *Runner) RunTestFile(t *testing.T, path string)
- type TestSequence
- type TestSuite
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertSortedMap ¶ added in v1.14.0
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 RunBenchmark ¶ added in v1.13.0
RunBenchmark runs a standard benchmark that executes expressions parsed from source.
func RunTestSuite ¶
RunTestSuite runs each TestSequence in tests on isolated lisp.LEnvs.
Types ¶
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) LoadBenchmarks ¶ added in v1.13.0
func (*Runner) RunBenchmark ¶ added in v1.13.0
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
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