trident-job / delphi-code-coverage

Automatically exported from code.google.com/p/delphi-code-coverage
0 stars 0 forks source link

Allow specifying lines with no expected coverage #16

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
There can be lines in the code who will never be covered, because of spurious 
compiler code generation or other special code situations.

One possible solution would be to detect special comments on a line, and when 
encountered, not report the line as not covered.

For instance in:

   procedure MyProc;
   begin
      ThisProcedureAlwaysTriggersAnException;
   end; {expected coverage issue}

the compiler will generate code for the 'end;', which can never be reached.
Other than spurious codegens, such cases can happen in other optimization 
scenarios where the compiler doesn't keep up.

Original issue reported on code.google.com by zar...@gmail.com on 22 Oct 2010 at 1:28

GoogleCodeExporter commented 9 years ago
It may be useful to have no coverage for many lines, you may have 
debugging-only code that won’t be executed during your unit tests.
Compilation directives like {$DEFINE DCD_OFF} and {$DEFINE DCD_ON} may be used 
to identifie the begin and the end of the not to cover code.
for instance :
   procedure MyProc;
   begin
      {$DEFINE DCD_OFF} //next lines will not be "Code Covered"
      if bDebug = True then
      begin
        ...
        ...
      end;
     {$DEFINE DCD_OFF} //next lines will be "Code Covered"
      ...
      ...  
   end; 

Original comment by Phil.Pr...@gmail.com on 22 Oct 2011 at 12:53

GoogleCodeExporter commented 9 years ago
I would rather to have poosibility to have ignore list on codu blocks / 
structures. It would be much more bigger and a lot more useful feature as it 
would allow to have indepth unhandled crash testing for unexpected situations 
and aggresive stability tests.

Original comment by linards....@gmail.com on 9 Apr 2012 at 12:16