gbdev/rgbds

Comments to exclude expected lines from code coverage report

Closed this issue · 0 comments

contrib/coverage.bash generates a code coverage report with LCOV. It can be distracting to go through the results and mentally ignore red lines that are expected -- "verbose" printfs, required methods that happen not to run (e.g. a const alternative to a non-const getter, or operator== and operator!=), fatal errors that will never practically occur (e.g. defining so many anonymous labels they would overflow the counter), etc.

LCOV supports some comments to ignore these:

  • // LCOV_EXCL_LINE at the end of a line
  • // LCOV_EXCL_START and LCOV_EXCL_STOP delimiting blocks

These would be in the same vein as the // clang-format off comments preserving our occasional custom formatting, or // IWYU pragma comments for guiding include-what-you-use.