Documentation
¶
Overview ¶
Package testhelpers provides shared test utilities for codegen packages.
Index ¶
- func AssertGoldenGo(t *testing.T, scenario string, name string, content string)
- func AssertGoldenGoAbs(t *testing.T, goldenPath string, content string)
- func BuildAndGenerate(t *testing.T, design func()) []*gcodegen.File
- func BuildAndGenerateExample(t *testing.T, design func()) []*gcodegen.File
- func BuildAndGenerateWithPkg(t *testing.T, genpkg string, design func()) []*gcodegen.File
- func FileContent(t *testing.T, files []*gcodegen.File, wantPath string) string
- func FileExists(files []*gcodegen.File, wantPath string) bool
- func FindFile(files []*gcodegen.File, wantPath string) *gcodegen.File
- func RunDesign(t *testing.T, design func()) (string, []eval.Root)
- func SetupEvalRoots(t *testing.T)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertGoldenGo ¶
AssertGoldenGo compares content as Go source with the golden file path relative to testdata/golden/<scenario>/...
func AssertGoldenGoAbs ¶
AssertGoldenGoAbs compares content as Go source with an absolute golden file path.
func BuildAndGenerate ¶
BuildAndGenerate executes the DSL, runs codegen and returns generated files.
func BuildAndGenerateExample ¶
BuildAndGenerateExample executes the DSL, runs example-phase codegen and returns files.
func BuildAndGenerateWithPkg ¶
BuildAndGenerateWithPkg executes the DSL with a custom package path.
func FileContent ¶
FileContent locates a generated file by path (slash-normalized) and returns the concatenated sections.
func FileExists ¶
FileExists checks if a file exists in the generated files.
func SetupEvalRoots ¶
SetupEvalRoots initializes and registers eval roots for testing.
Types ¶
This section is empty.