Documentation ¶
Overview ¶
Package testutils implements reusable helpers for writing compiler tests.
Index ¶
- Variables
- func Encode(vals ...interface{}) []byte
- func Pad(n int) []byte
- type Cmd
- func (c *Cmd) API() api.API
- func (c *Cmd) Alive() bool
- func (c *Cmd) Caller() api.CmdID
- func (c *Cmd) Clone(arena.Arena) api.Cmd
- func (c *Cmd) CmdFlags(context.Context, api.CmdID, *api.GlobalState) api.CmdFlags
- func (c *Cmd) CmdName() string
- func (c *Cmd) CmdParams() api.Properties
- func (c *Cmd) CmdResult() *api.Property
- func (c Cmd) Encode(out []byte) bool
- func (c *Cmd) Extras() *api.CmdExtras
- func (c *Cmd) Mutate(context.Context, api.CmdID, *api.GlobalState, *builder.Builder, ...) error
- func (c *Cmd) SetCaller(api.CmdID)
- func (c *Cmd) SetTerminated(terminated bool)
- func (c *Cmd) SetThread(thread uint64)
- func (c *Cmd) Terminated() bool
- func (c *Cmd) Thread() uint64
- type Extras
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type Cmd ¶
type Cmd struct { N string // Command name D []byte // Encoded command used by the compiler generated execute function E *Extras // Command extras T uint64 // Command thread }
Cmd is a custom implementation of the api.Cmd interface that simplifies testing compiler generated commands.
func (*Cmd) CmdParams ¶
func (c *Cmd) CmdParams() api.Properties
CmdParams stubs the api.Cmd interface.
func (Cmd) Encode ¶
Encode implements the executor.Encodable interface to encode the command to a buffer used by the compiler generated execute function.
func (*Cmd) Mutate ¶
func (c *Cmd) Mutate(context.Context, api.CmdID, *api.GlobalState, *builder.Builder, api.StateWatcher) error
Mutate stubs the api.Cmd interface.
func (*Cmd) SetTerminated ¶
SetTerminated stubs the api.Cmd interface.
type Extras ¶
type Extras struct {
// contains filtered or unexported fields
}
Extras is a helper wrapper around an api.CmdExtras has helpers methods for adding read and writ observations.
func R ¶
R creates and returns a new Extras containing a single read using the given range and data.
func W ¶
W creates and returns a new Extras containing a single write using the given range and data.