Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsUpdate ¶
func IsUpdate() bool
IsUpdate returns true if the -update flag was passed to the test.
func MkdirTemp ¶
MkdirTemp creates a temporary directory.
It returns the path to the created temporary directory and a clean-up function which allows to delete it.
func ProjectRoot ¶
ProjectRoot searches from the current working directory upwards until it finds a go.mod file. The directory containing the go.mod file is then assumed to be the root of this project.
Types ¶
type Converter ¶
Converter defines a type that is capable from converting some input to some output.
type ConverterTest ¶
type ConverterTest struct {
Name string // Name of the test case. Derived from InFile if empty.
InputFile string // Input file for the test case.
ExpectedFile string // File containing expected output.
Converter Converter // The converter to test.
}
ConverterTest is a test case for a conversion from one file format to another.
The default name of the converter test case is derived from the name of the input file. The default name can be overridden by setting the Name field.
If the -update flag is passed to the test, the ConverterTest writes any output produced to the ExpectedFile before comparison.
func FindConverterTests ¶
func FindConverterTests(t *testing.T, dir, glob string, c Converter) []*ConverterTest
FindConverterTests searches dir for files matching glob and creates a converter test from them.
All expectation files created by converter tests have the name of the respective input file with the suffix .golden appended to them.
func (*ConverterTest) Run ¶
func (tt *ConverterTest) Run(t *testing.T)
Run runs the converter test case.