Add logicalOR coverage for "return" conditions

logical-or-coverage
cgewecke 5 years ago
parent d7a88c9933
commit 5566d6da2e
  1. 2
      lib/instrumenter.js
  2. 3
      lib/parse.js
  3. 4
      test/units/or.js

@ -61,6 +61,8 @@ class Instrumenter {
// First, we run over the original contract to get the source mapping.
let ast = SolidityParser.parse(contract.source, {range: true});
//console.log(JSON.stringify(ast, null, ' '))
parse[ast.type](contract, ast);
const retValue = JSON.parse(JSON.stringify(contract)); // Possibly apotropaic.

@ -185,6 +185,9 @@ parse.SourceUnit = function(contract, expression) {
parse.ReturnStatement = function(contract, expression) {
register.statement(contract, expression);
parse[expression.expression.type] &&
parse[expression.expression.type](contract, expression.expression, true);
};
// TODO:Investigate node structure

@ -159,7 +159,7 @@ describe('logical OR branches', () => {
5: 1,
});
assert.deepEqual(mapping[util.filePath].b, {
1: [ 1, 0 ]
});
assert.deepEqual(mapping[util.filePath].s, {
1: 1,
@ -182,7 +182,7 @@ describe('logical OR branches', () => {
5: 2,
});
assert.deepEqual(mapping[util.filePath].b, {
1: [ 1, 1 ]
});
assert.deepEqual(mapping[util.filePath].s, {
1: 2,

Loading…
Cancel
Save