BL_AKN's avatar
Regular Visitor
9 years ago
New Idea

Ignore unreachable code in code coverage reports

We are using the "Light Coverage Profiler" with "collect info about lines: on" for creating coverage reports of our unit tests.


Let's say, you have C++ code like this:

__declspec(noreturn) void throw_bad_cast();

__declspec(noreturn) void throw_bad_cast()
  throw bad_any_cast{};

And let's assume that the function is hit when the main program is executed.
However, AQtime will mark the last line of the function "throw_bad_cast" as "not covered" (the line with the closing brace).
The (invisible) return statement of the function will never be reached, so the resulting report gives the impression that the code coverage is incomplete.

Thus, it would be nice if unreachable code like this would be ignored in the coverage results so that the function is marked with "coverage 100%".