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[T], options ...RunOption, )
Run searches a directory for tests and executes them as sub-tests of t.
By default it searches the ./testdata directory; use the FromDir option to search a different directory.
g is an OutputGenerator that produces output from input values for each test. If the output produced by g does not match the test's expected output the test fails.
Types ¶
type Input ¶ added in v0.2.0
type Input interface { io.Reader // Language returns the language of the input value, if known, e.g. "json", // "yaml", etc. Language() string // Attributes returns a set of key-value pairs that provide additional // loader-specific information about the input. Attributes() map[string]string }
Input is an interface for the input to a test.
type Output ¶ added in v0.2.0
type Output interface { io.Writer // Language returns the expected language of the output value, if known, // e.g. "json", "yaml", etc. Language() string // Attributes returns a set of key-value pairs that provide additional // loader-specific information about the expected output. Attributes() map[string]string }
Output is an interface for producing the output for a test.
type OutputGenerator ¶
OutputGenerator produces the output of a specific test.
type RunOption ¶
type RunOption func(*runOptions)
RunOption is an option that changes the behavior of Run.
func AssertionFilter ¶ added in v0.2.10
AssertionFilter is a RunOption limits test execution to those tests that use a language that matches the given predicate function. It does not prevent the tests from being loaded.
func Bless ¶ added in v0.2.4
Bless is a RunOption that enables or disables "blessing" of failed tests.
If blessing is enabled, the file containing the expected output of each failed assertion is replaced with the actual output.
By default blessing is disabled unless the -aureus.bless flag is set on the command line.
func FromDir ¶ added in v0.2.0
FromDir is a RunOption that sets the directory to search for tests. By default the ./testdata directory is used.
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
cliflags
Package flags defines the command-line flags used by Aureus during test execution.
|
Package flags defines the command-line flags used by Aureus during test execution. |
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. |