Menu

#16 Allow specifying lines with no expected coverage

New
nobody
None
Medium
Defect
2012-04-09
2010-10-22
Anonymous
No

Originally created by: zar...@gmail.com

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.

Discussion

  • Anonymous

    Anonymous - 2011-10-22

    Originally posted by: Phil.Pr...@gmail.com

    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;

     
  • Anonymous

    Anonymous - 2012-04-09

    Originally posted by: linards....@gmail.com

    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.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.