Documentation ¶
Overview ¶
Package aureus runs "golden file" style tests defined in Markdown documents.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
func Run[T runner.TestingT[T]](t T, g OutputGenerator, options ...RunOption)
Run searches a directory for "golden" tests and executes them as sub-tests of t.
By default is searches the ./testdata directory for test cases. This can be changed using the WithDir option.
g is a function that generates output from input values. It is called for each test case. If the output it produces does not match the expected output.
Types ¶
type ContentMetaData ¶
type ContentMetaData = test.ContentMetaData
ContentMetaData contains information about input or output content.
type OutputGenerator ¶
type OutputGenerator func( w io.Writer, in Content, out ContentMetaData, ) error
OutputGenerator produced output for a test case's input.
in is the input data for the test case. out is meta-data about the expected output, which may be used to influence the kind of output that the generator writes to w.
type RunOption ¶
type RunOption func(*runOptions)
RunOption is an option that changes the behavior of Run.
func WithDir ¶
WithDir is a RunOption that sets the directory to search for test cases. By default the ./testdata directory is used.
func WithRecursion ¶
WithRecursion is a RunOption that enables or disables recursion when searching for test cases. By default recursion is enabled.
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
diff
Package diff implements a basic diff algorithm equivalent to patience diff.
|
Package diff implements a basic diff algorithm equivalent to patience diff. |
loader
Package loader loads tests from various sources.
|
Package loader loads tests from various sources. |
loader/fileloader
Package fileloader loads [test.Test] values from files containing test inputs and expected outputs.
|
Package fileloader loads [test.Test] values from files containing test inputs and expected outputs. |
loader/internal/loadertest
Package loadertest provides a basic golden-file style test running for testing Aureus' internal loader implementations.
|
Package loadertest provides a basic golden-file style test running for testing Aureus' internal loader implementations. |
loader/markdownloader
Package markdownloader loads [test.Test] values from Markdown files containing code blocks representing test inputs and expected outputs.
|
Package markdownloader loads [test.Test] values from Markdown files containing code blocks representing test inputs and expected outputs. |
rootfs
Package rootfs provides an [fs.FS] implementation that uses the OS's root file system.
|
Package rootfs provides an [fs.FS] implementation that uses the OS's root file system. |
runner
Package runner executes [test.Test] values under Go's native test framework and other test frameworks with a similar interface.
|
Package runner executes [test.Test] values under Go's native test framework and other test frameworks with a similar interface. |
test
Package test defines a tree structure that describes the tests loaded from one or more Aureus Markdown documents.
|
Package test defines a tree structure that describes the tests loaded from one or more Aureus Markdown documents. |