testgen
packagestandard libraryThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
Constants¶
This section is empty.
Variables¶
var (NoString = ""NoStack = []trace.StackFrame{})
Functions¶
Types¶
typeBatch¶
type Batch struct {// contains filtered or unexported fields}
Batch represents an event batch.
typeGeneration¶
type Generation struct {// contains filtered or unexported fields}
Generation represents a single generation in the trace.
func (*Generation)Batch¶
func (g *Generation) Batch(threadtrace.ThreadID, timeTime) *Batch
Batch starts a new event batch in the trace data.
This is convenience function for generating correct batches.
func (*Generation)Stack¶
func (g *Generation) Stack(stk []trace.StackFrame)uint64
Stack registers a stack with the trace.
This is a convenience function for easily adding correctstacks to traces.
func (*Generation)String¶
func (g *Generation) String(sstring)uint64
String registers a string with the trace.
This is a convenience function for easily adding correctstrings to traces.
typeTime¶
type Timeuint64
Time represents a low-level trace timestamp (which does not necessarilycorrespond to nanoseconds, like trace.Time does).
typeTrace¶
type Trace struct {// contains filtered or unexported fields}
Trace represents an execution trace for testing.
It does a little bit of work to ensure that the produced trace is valid,just for convenience. It mainly tracks batches and batch sizes (so they'retrivially correct), tracks strings and stacks, and makes sure emitted stringand stack batches are valid. That last part can be controlled by a few options.
Otherwise, it performs no validation on the trace at all.
func (*Trace)DisableTimestamps¶
func (t *Trace) DisableTimestamps()
DisableTimestamps makes the timestamps for all events generated afterthis call zero. Raw events are exempted from this because the callerhas to pass their own timestamp into those events anyway.
func (*Trace)ExpectFailure¶
ExpectFailure writes down that the trace should be broken. The callermust provide a pattern matching the expected error produced by the parser.
func (*Trace)ExpectSuccess¶
func (t *Trace) ExpectSuccess()
ExpectSuccess writes down that the trace should successfully parse.
func (*Trace)Generation¶
func (t *Trace) Generation(genuint64) *Generation
Generation creates a new trace generation.
This provides more structure than Event to allow for more easilycreating complex traces that are mostly or completely correct.