testhelpers

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package testhelpers provides shared test utilities for codegen packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertGoldenGo

func AssertGoldenGo(t *testing.T, scenario string, name string, content string)

AssertGoldenGo compares content as Go source with the golden file path relative to testdata/golden/<scenario>/...

func AssertGoldenGoAbs

func AssertGoldenGoAbs(t *testing.T, goldenPath string, content string)

AssertGoldenGoAbs compares content as Go source with an absolute golden file path.

func BuildAndGenerate

func BuildAndGenerate(t *testing.T, design func()) []*gcodegen.File

BuildAndGenerate executes the DSL, runs codegen and returns generated files.

func BuildAndGenerateExample

func BuildAndGenerateExample(t *testing.T, design func()) []*gcodegen.File

BuildAndGenerateExample executes the DSL, runs example-phase codegen and returns files.

func BuildAndGenerateWithPkg

func BuildAndGenerateWithPkg(t *testing.T, genpkg string, design func()) []*gcodegen.File

BuildAndGenerateWithPkg executes the DSL with a custom package path.

func FileContent

func FileContent(t *testing.T, files []*gcodegen.File, wantPath string) string

FileContent locates a generated file by path (slash-normalized) and returns the concatenated sections.

func FileExists

func FileExists(files []*gcodegen.File, wantPath string) bool

FileExists checks if a file exists in the generated files.

func FindFile

func FindFile(files []*gcodegen.File, wantPath string) *gcodegen.File

FindFile locates a generated file by path (slash-normalized).

func RunDesign

func RunDesign(t *testing.T, design func()) (string, []eval.Root)

RunDesign prepares roots for generation by executing the DSL.

func SetupEvalRoots

func SetupEvalRoots(t *testing.T)

SetupEvalRoots initializes and registers eval roots for testing.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL