Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ObjectsMap ¶
Types ¶
type FileComparator ¶
type GoldenFilesTestSuite ¶
type GoldenFilesTestSuite struct { // Run the test suite on this directory. TestDataRoot string // Name is a unique name for this test. The golden files for this test are // expected to live under `${TestDataRoot}/[test]/${Name}`. Name string // Skip is a map of tests to skip; the key is the test name; the value is the // skip message. Skip map[string]string // FileComparator is called to compare a golden file with its test-generated equivalent. // TrimSpacesDiffComparator is used if no comparator is provided. FileComparator FileComparator }
A GoldenFilesTestSuite represents a test run that processes inputs from a given directory and compares results against "golden files". See the Test documentation for more details.
type Test ¶
type Test struct { // Allow Test to be used as a T. *testing.T // RootDir is the path of the current test directory. RootDir string // OutputDir is the path where golden files live for this test. OutputDir string // contains filtered or unexported fields }
A Test represents a single test.
A Test embeds *testing.T and should be used to report errors.
When the test function has returned, output written with [Test.Write], [Test.Writer], Test.WriteFile and friends is checked against the expected output files.
If the output differs and $COG_UPDATE_GOLDEN is non-empty, the txtar file will be updated and written to disk with the actual output data replacing the out files.
func (*Test) BuildersContext ¶
BuildersContext locates and returns the builders intermediate representation described within the txtar archive.
func (*Test) TypesIR ¶
TypesIR locates and returns the raw types intermediate representation described within the txtar archive.
func (*Test) WriteFile ¶
WriteFile writes a codejen.File to the main output.
func (*Test) WriteFiles ¶
WriteFiles writes a list of codejen.File to the main output.