testhelpers

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 production DSL, prepare, and generation phases.

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 production generation phases 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