Documentation
¶
Overview ¶
Package testutil provides shared test helpers for both the machine/ and machine/compilation/ test suites. It exists to break the import cycle between machine (which cannot import compilation) and tests that need both packages.
Index ¶
- func EvalScheme(t *testing.T, code string) values.Value
- func EvalSchemeInEnv(t *testing.T, env *environment.EnvironmentFrame, code string) values.Value
- func NewFullRuntimeEnv(t *testing.T) *environment.EnvironmentFrame
- func NewMinimalNamespace(env *environment.EnvironmentFrame) *environment.EnvironmentFrame
- func NewTopLevelThunk(sv syntax.SyntaxValue, env *environment.EnvironmentFrame) (*machine.MachineContinuation, error)
- func ParseSchemeExpr(t *testing.T, env *environment.EnvironmentFrame, code string) syntax.SyntaxValue
- func SetupLibraryTest(t *testing.T, testdataPath string) *environment.EnvironmentFrame
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EvalScheme ¶
EvalScheme evaluates one or more Scheme expressions and returns the last value. Fails the test on any error.
func EvalSchemeInEnv ¶
func EvalSchemeInEnv(t *testing.T, env *environment.EnvironmentFrame, code string) values.Value
EvalSchemeInEnv evaluates one or more Scheme expressions in the given environment and returns the last value.
func NewFullRuntimeEnv ¶
func NewFullRuntimeEnv(t *testing.T) *environment.EnvironmentFrame
NewFullRuntimeEnv creates a full runtime environment with all primitives and bootstrap macros registered.
func NewMinimalNamespace ¶
func NewMinimalNamespace(env *environment.EnvironmentFrame) *environment.EnvironmentFrame
NewMinimalNamespace creates a minimal namespace with core special form bindings registered (if, lambda, quote, etc.). Useful for unit tests that need compilation without a full bootstrap.
func NewTopLevelThunk ¶
func NewTopLevelThunk( sv syntax.SyntaxValue, env *environment.EnvironmentFrame, ) (*machine.MachineContinuation, error)
NewTopLevelThunk expands, compiles, and wraps a syntax value into a continuation ready for MachineContext.Run().
func ParseSchemeExpr ¶
func ParseSchemeExpr(t *testing.T, env *environment.EnvironmentFrame, code string) syntax.SyntaxValue
ParseSchemeExpr parses a single Scheme expression from code.
func SetupLibraryTest ¶
func SetupLibraryTest(t *testing.T, testdataPath string) *environment.EnvironmentFrame
SetupLibraryTest creates a test environment with library loading capability, using the testdata/ directory at the given path as the library search path.
Types ¶
This section is empty.