the only thing I could find was https://hookrace.net/blog/nim-code-coverage/
however instructions didn't work: /cc @def-
after lcov --base-directory . --directory . -c -o x.info, x.info ends up empty
really would love to be able to reproduce these results @def- had here(https://hookrace.net/public/coverage-minimal/cov/x.nim.gcov.html)
You don't need a tool in Nim to get coverage report. I have lcov.info coverage file generated and coverage displayed with VSCode plugin https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters.
I am using slightly modified version of https://github.com/yglukhov/coverage module.
Really happy with the way it works.
from my understanding, that library requires heavily modifying source code of project for which I want code coverage:
Add "import coverage" and the top of your sources and add "{.cov.}" to every proc.
hardly seems practical; how long would that manual task take for a project like nim itself?
instead, it should be automatic, and enabled by compiler via a flag nim -cov=coverage_options foo.nim
(in much same way as compiler flags are used to insert debug info, line info, etc)
@timotheecour I made a working version of HookRace code coverage version through a Nimble task. It's automated and based on the unit tests in the folder tests/.
You can check it out here: https://github.com/samuelroy/nim-coverage. Let me know if it works for you.
thanks! will comment directly in your repo
Well I consider this question solved then.
can we re-open? a working coverage tool is important to have (alongside debugging, profiling tools)
I'm almost sure this will work and not be too complex to implement
Most helpful comment
can we re-open? a working coverage tool is important to have (alongside debugging, profiling tools)
I'm almost sure this will work and not be too complex to implement