Skip to content

Slather 2.8.5 generates Cobertura file wtih incorrect hit count for condition lines #582

@sfloam

Description

@sfloam

When running slather coverage -x --output-directory Coverage/ --arch arm64 --scheme MyScheme whe noticed that the Cobertura file generated by Slather had lines where the hits="0" but the condition-coverage="100%". If the condition-coverage is at 100%, it would have had to have hit that line.

If the hits="0", how can the condition-converage be 100%?

 <line number="23" branch="true" hits="13" condition-coverage="100% (3/3)">
  <conditions>
    <condition number="0" type="jump" coverage="100%"/>
  </conditions>
</line>
<line number="24" branch="false" hits="13"/>
<line number="25" branch="true" hits="13" condition-coverage="0% (0/2)">
  <conditions>
    <condition number="0" type="jump" coverage="0%"/>
  </conditions>
</line>
<line number="26" branch="true" hits="0" condition-coverage="0% (0/2)"> 
  <conditions>
    <condition number="0" type="jump" coverage="0%"/>
  </conditions>
</line>
<line number="27" branch="true" hits="0" condition-coverage="100% (1/1)">  <-------- How can hits=0 with condition-coverage 100%
  <conditions>
    <condition number="0" type="jump" coverage="100%"/>
  </conditions>
</line>

	22 |  for (SomeElement *childNode in node.children) {
	23 |	  if ([childNode.name isEqualToString:SomeThing]) {
	24 |	    [self _doSomething:childNode];
	25 |	  } else {
	26 |	    SomeMacroForPrintingWithIfInIt(@"someMessage %@", childNode.name);
	27 |	  }
	28 |	}	

Note the problematic line is line 27 having a hit=0 with a condiiton-coverage=100%.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions