Documentation ¶
Overview ¶
Package markdownloader loads test.Test values from Markdown files containing code blocks representing test inputs and expected outputs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadContent ¶
LoadContent is the default ContentLoader implementation.
Types ¶
type ContentLoader ¶
A ContentLoader is a function that returns content obtained from a fenced code block.
info is the "info string" of the code block, that is the line of text that contains the language and other loader-specific information.
type LoadOption ¶
type LoadOption func(*loadOptions)
LoadOption is an option that changes the behavior of a Loader.
func WithContentLoader ¶
func WithContentLoader(load ContentLoader) LoadOption
WithContentLoader is a LoadOption that configures an alternative ContentLoader used to load content from code blocks.
func WithFS ¶
func WithFS(f fs.FS) LoadOption
WithFS is a LoadOption that configures an alternative filesystem to use when loading tests.
func WithParser ¶
func WithParser(p parser.Parser) LoadOption
WithParser is a LoadOption that configures an alternative Markdown parser to use when loading tests.
func WithRecursion ¶
func WithRecursion(on bool) LoadOption
WithRecursion if a LoadOption that enables or disables recursive scanning of sub-directories.
Recursion is enabled by default.
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader loads test.Test values from Markdown files containing code blocks representing test inputs and expected outputs.
func NewLoader ¶
func NewLoader(options ...LoadOption) *Loader
NewLoader returns a new Loader, which loads golden file tests from the filesystem.