JoinColony / solcover

Code coverage for solidity
MIT License
64 stars 8 forks source link

"Same line" statements belonging to "else" bodies are not reported #38

Open cgewecke opened 7 years ago

cgewecke commented 7 years ago

Istanbul reports a taken else branch as follows ifelse

Solcover reports: elsesol

The instrumentation looks like this:

Coverage('/Users/user/Sites/sol-coveralls/solcover/test.sol',5);
         StatementCoverage('/Users/user/Sites/sol-coveralls/solcover/test.sol',1);
if (x == 1) {BranchCoverage('/Users/user/Sites/sol-coveralls/solcover/test.sol',1,0);  StatementCoverage('/Users/user/Sites/sol-coveralls/solcover/test.sol',2);
x+= 1;}
        else {BranchCoverage('/Users/user/Sites/sol-coveralls/solcover/test.sol',1,1);  StatementCoverage('/Users/user/Sites/sol-coveralls/solcover/test.sol',3);
x += 5;}
    }

Same as #37.

cgewecke commented 7 years ago

@area I feel like this same-line else construction is relatively common and Istanbul's report is intuitively more informative. But as you note in #37 - the obvious fix would produce 11 hits. Also bound up with the else if analysis you made in the highlighting issue. . . . not sure what should be done here.

area commented 7 years ago

I agree that our output here definitely could be better. I'll have a fiddle!