Documentation
¶
Overview ¶
Package testbuild provides helper functions to test the build step in GX.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareString ¶
CompareString compares two string and build an error message if the strings do not match.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder builds test source code.
type Decl ¶
type Decl struct {
// Src is the GX source code.
Src string
// Want is the set of nodes that is expected from the compiler to build.
// If nil (or length 0), the output of the compiler is not checked.
Want []ir.Node
// Err is the substring expected if the compiler returns an error.
Err string
}
Decl specifies a test with GX code declarations.
type DeclarePackage ¶
type DeclarePackage struct {
// Source code of the package.
Src string
// Function called (if not nil) after the package has been built.
// Can be use to provide the implementation of builtin functions.
Post func(*ir.Package)
}
DeclarePackage declares a package for the following tests.
func (DeclarePackage) Run ¶
func (tt DeclarePackage) Run(b *Builder) error
Run the source code to declare it as an importable package.
type Expr ¶
type Expr struct {
// Src is the source code of the expression.
Src string
// Want is the expression expected to be built by the compiler.
Want ir.Expr
// WantType is the string representation of the expression expected to be built by the compiler.
WantType string
// Err is the error expected by the compiler when the expression does not compile.
Err string
}
Expr specifies a test of a GX expression.
Click to show internal directories.
Click to hide internal directories.