Nim Code Coverage2016-11-01 · Nim · Programming
Creating code coverage reports with Nim is surprisingly easy. You can simply
use the good old gcov and lcov tools. Nim can be told to insert its own line
information with the
--debugger:native command line parameter.
Here's the small example program we're looking at:
Note that if we change the condition to
if false: the Nim compiler optimizes
the impossible code away and it will not count as uncovered. The same thing can
happen with entire uncovered functions when optimizations and dead code
elimination are enabled.
The file is saved as
x.nim. Here's the script I use to create the code
You can look at the final html report generated.