Documentation
¶
Overview ¶
Package coverage collects per-s-expression coverage data from executing Wile Scheme code. Each coverage entry corresponds to a unique SourceContext (file + start/end line/column), aggregated across all compiled NativeTemplates.
Known limitations:
- Instructions synthesized by the peephole optimizer may drop their source attribution (see machine/peephole_test.go:540). Such PCs execute but produce no Entry.
- Instructions with no source context (synthetic infrastructure ops) are skipped.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteGoCover ¶
WriteGoCover writes the collector's entries in Go cover v1 format (mode: set), excluding stdlib paths. The output is consumable by 'go tool cover -html -o report.html <file>'.
func WriteGoCoverIncludingStdlib ¶
WriteGoCoverIncludingStdlib is like WriteGoCover but includes entries from embedded stdlib files.
func WriteSummary ¶
WriteSummary writes a human-readable per-line coverage summary with a total footer. Each line emits:
<file>:<line> <covered>/<total> covered max_col_reached=<col>
max_col_reached is the maximum start column of any covered sexpr on that line, under the interpretation "how deep did we get." Honest under non-branching sequences like (begin a b c); approximate under branches — a high max_col_reached with low covered/total means execution skipped sexprs in the middle.
Stdlib paths are excluded.
Types ¶
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector aggregates coverage data across a set of tracked templates. A zero Collector is not usable; construct with NewCollector.
func (*Collector) Entries ¶
Entries returns one Entry per unique SourceContext seen across all tracked templates. Entries are sorted lexicographically by (File, StartLine, StartCol, EndLine, EndCol). An s-expression is reported with Count=1 iff any instruction referring to its SourceContext executed (mode=set).
func (*Collector) Track ¶
func (p *Collector) Track(tpl *machine.NativeTemplate)
Track enables coverage on a template and adds it to the collector's tracked set. Calling Track multiple times with the same template is a no-op (templates are deduplicated by pointer identity).