Skip to main content

Module coverage

Module coverage 

Source
Expand description

GDScript coverage instrumentation.

Inserts Gdt._cov_hit("res://path", line) before each executable line inside function bodies. Uses gdsyntax to identify function body line ranges; blank lines and comment lines are skipped via text heuristics.

The caller is responsible for backing up original files before writing the instrumented bytes and restoring them after the test run.

Functions§

instrument_file
Instrument a GDScript source file for coverage tracking. Returns (instrumented_bytes, instrumented_line_numbers). instrumented_line_numbers is the set of 1-based line numbers that received a hit-tracking call — this is the “lines found” (LF) count for LCOV.
instrument_source
Instrument raw GDScript bytes. Returns (instrumented_bytes, instrumented_lines).