Documentation ¶
Overview ¶
Package loader loads tests from various sources.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Content ¶
type Content struct { // Role is the role that the content plays within a test. A value of // [NoRole] indicates that the content has no specific role within the test. Role ContentRole // Group is the name of the group to which the content belongs. Inputs and // outputs in the same group form a matrix of test cases. Group string // Language is the language of the content, if known, e.g. "json", "yaml", // etc. Content with an empty language is treated as plain text. Language string // Attributes is a set of key-value pairs that provide additional // loader-specific information about the data. Attributes map[string]string // Data is the content itself. It is always considered to be human-readable // text, such as source code. Data string }
Content is a specialization of test.Content that includes meta-data about how it was loaded and how it should appear within tests.
type ContentEnvelope ¶
type ContentEnvelope struct { // File is the path of the file from which the content was loaded. File string // Line is the line number within the file where the content begins, or 0 if // the content represents the entire file. Line int // Skip is a flag that indicates whether this content should be skipped when // running tests. Skip bool // Content is the loaded content. Content Content }
ContentEnvelope is a container for Content and meta-data about how it was loaded.
func SeparateContentByRole ¶
func SeparateContentByRole(content []ContentEnvelope) (inputs, outputs []ContentEnvelope)
SeparateContentByRole separates content into inputs and outputs.
func (ContentEnvelope) AsTestContent ¶
func (e ContentEnvelope) AsTestContent() test.Content
AsTestContent returns the content as a test.Content.
type ContentRole ¶
type ContentRole int
ContentRole is an enumeration of the roles that loaded content can play within in a test.
const ( // NoRole indicates that the content has no specific role within the test. NoRole ContentRole = iota // Input indicates that the content is an input to a test. Input // Output indicates that the content is the expected output from a test. Output )
type TestBuilder ¶
type TestBuilder struct {
// contains filtered or unexported fields
}
TestBuilder builds test.Test values from groups of correlated inputs and outputs.
func (*TestBuilder) AddContent ¶
func (b *TestBuilder) AddContent(env ContentEnvelope)
AddContent adds content to the builder.
Content with no [Role] is ignored.
func (*TestBuilder) AddTest ¶
func (b *TestBuilder) AddTest(t test.Test)
AddTest adds a pre-built test to the builder.
Empty tests are ignored.
Directories ¶
Path | Synopsis |
---|---|
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. |
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. |
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. |