Skip to content

Make LCOV ignore code unreachable in tests

username-removed-1096594 requested to merge traas/open-adventure:master into master

I'm not sure if you want to use this tactic or not -- this is my first time working on a project with coverage testing, so I'm unsure of the wisdom of what I've done.

I've identified 3 types of code that I believe to be unreachable in testing:

  1. code that requires interactivity (like being able to type ^C)
  2. code that tests for an OOM error
  3. bugs, that should be unreachable by design

I've made 3 different commits, ordered in how certain I am about their legitimacy:

9a4dccf4 - sig_handler() and OOM check in xmalloc() 94bf6404 - bug() and all calls to BUG() d04e1e58 - some bits of misc.c that I think are unreachable because they require interactivity, but could be wrong

Also: am I correct that dungeon.c is going away eventually, and thus I shouldn't worry about getting perfect test coverage there?

Merge request reports