package windtrap
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=2241b294b24ed5d56ea8b834d296e6fabc5dbdd924a89f51c14b00da66c50a25
sha512=c6cf83028bb09d0f2afeb38fce6825620873a6bbeff4b5b77e928bc2fc69262d49fe341961cba2b451c9dc9bd0df414f06bb73020c7131b125c6abd85c6bc5dd
doc/windtrap.coverage/Windtrap_coverage/index.html
Module Windtrap_coverageSource
Coverage data collection and reporting.
Instrumented code calls register_file at module load time; visit functions increment counters during execution; an at_exit handler writes .coverage files to disk. The test runner reads data directly for inline reporting.
Types
Output Configuration
set_output_prefix path sets the directory and filename prefix for .coverage files written at exit. For example, set_output_prefix "/project/_build/_coverage/windtrap" writes files like /project/_build/_coverage/windtrap123456789.coverage. The directory is created automatically when coverage data is written. Can be overridden by the WINDTRAP_COVERAGE_FILE environment variable.
Registration
Register an instrumented source file. Called by PPX-generated code at module load time. Returns a visit function that increments the counter for a given point index. Registers an at_exit handler on first call.
Data Access
Return the accumulated in-memory coverage data. Empty if no instrumented files have been registered.
Reset all counters to zero without removing registered files.
Serialization
Magic header for .coverage files.
Serialize coverage data to the binary format used by .coverage files.
Deserialization
Read a single .coverage file. Returns an empty list if the file has an invalid header, is unreadable, or is truncated.
Merging
merge tbl files folds files into tbl, using saturating addition when the same source file appears more than once.
Reporting
Compute aggregate (visited, total) counts across all files.
Per-file summaries sorted by filename.
Return a color style based on coverage percentage: green >= 80%, yellow >= 60%, red < 60%. Useful with Pp.styled for inline output.
collapse_ranges lines collapses a sorted list of line numbers into contiguous ranges. E.g., [1; 2; 3; 7; 8] becomes [(1, 3); (7, 8)].
format_ranges ranges formats ranges as "1-3, 7-8". Single lines appear without a dash.
Build deterministic per-file coverage reports with uncovered points and uncovered line numbers.
source_paths is used to resolve source files for line mapping. When a source file can't be found or read, uncovered_lines is empty and source_available is false.
val print_summary :
per_file:bool ->
skip_covered:bool ->
?source_paths:string list ->
coverage ->
unitPrint a human-readable coverage report to stdout with color-coded percentages. When per_file is true and source_paths is provided, uncovered line ranges are shown below each file. When skip_covered is true, files with 100% coverage are omitted from the per-file report.
Print uncovered source code snippets with surrounding context lines. Each uncovered line is prefixed with > and highlighted. Context lines are dimmed. Only files with uncovered lines and available source are shown. context defaults to 1.