Merge pull request #7 from sc-forks/restructure-directories

Move files into /lib and /bin
pull/8/head
c-g-e-w-e-k-e- 8 years ago committed by GitHub
commit 5101d92ecb
  1. 4
      bin/exec.js
  2. 0
      lib/coverageMap.js
  3. 0
      lib/injector.js
  4. 4
      lib/instrumentSolidity.js
  5. 0
      lib/instrumenter.js
  6. 15
      lib/parse.js
  7. 0
      lib/preprocessor.js
  8. 2
      package.json
  9. 2
      test/cli.js
  10. 4
      test/conditional.js
  11. 2
      test/expressions.js
  12. 4
      test/function.js
  13. 4
      test/if.js
  14. 4
      test/loops.js
  15. 2
      test/return.js
  16. 4
      test/statements.js
  17. 2
      test/zeppelin.js

@ -5,9 +5,9 @@ const fs = require('fs');
const reqCwd = require('req-cwd');
const path = require('path');
const childprocess = require('child_process');
const getInstrumentedVersion = require('./instrumentSolidity.js');
const CoverageMap = require('./coverageMap.js');
const istanbul = require('istanbul');
const getInstrumentedVersion = require('./../lib/instrumentSolidity.js');
const CoverageMap = require('./../lib/coverageMap.js');
const istanbulCollector = new istanbul.Collector();
const istanbulReporter = new istanbul.Reporter();

@ -3,8 +3,6 @@ const preprocessor = require('./preprocessor');
const injector = require('./injector');
const parse = require('./parse');
// var solparse = require("solparse");
const path = require('path');
module.exports = function instrumentSolidity(contractSource, fileName) {
@ -47,8 +45,6 @@ module.exports = function instrumentSolidity(contractSource, fileName) {
parse[ast.type](contract, ast);
// var result = solparse.parse(contract);
// We have to iterate through these injection points in descending order to not mess up
// the injection process.
const sortedPoints = Object.keys(contract.injectionPoints).sort((a, b) => b - a);

@ -71,17 +71,11 @@ const instrumenter = require('./instrumenter');
parse.AssignmentExpression = function parseAssignmentExpression(contract, expression) {
instrumenter.instrumentStatement(contract, expression);
instrumenter.instrumentAssignmentExpression(contract, expression);
// parse[expression.left.type](contract, expression.left);
// parse[expression.right.type](contract, expression.right);
};
parse.ConditionalExpression = function parseConditionalExpression(contract, expression) {
instrumenter.instrumentStatement(contract, expression);
instrumenter.instrumentConditionalExpression(contract, expression);
// parse[expression.test.left.type](contract, expression.test.left);
// parse[expression.test.right.type](contract, expression.test.right);
// parse[expression.consequent.type](contract, expression.consequent);
// parse[expression.alternate.type](contract, expression.alternate);
};
parse.Modifiers = function parseModifier(contract, modifiers) {
@ -94,21 +88,14 @@ parse.Modifiers = function parseModifier(contract, modifiers) {
parse.ReturnStatement = function parseReturnStatement(contract, expression) {
instrumenter.instrumentStatement(contract, expression);
// if (expression.argument){
// parse[expression.argument.type](contract, expression.argument);
// }
};
parse.NewExpression = function parseNewExpression(contract, expression) {
parse[expression.callee.type](contract, expression.callee);
// expression.arguments.forEach(construct => {
// parse[construct.type](construct);
// });
};
parse.MemberExpression = function parseMemberExpression(contract, expression) {
parse[expression.object.type](contract, expression.object);
// parse[expression.property.type](contract, expression.property);
};
parse.CallExpression = function parseCallExpression(contract, expression) {
@ -145,7 +132,6 @@ parse.IfStatement = function parseIfStatement(contract, expression) {
};
parse.ExpressionStatement = function parseExpressionStatement(contract, content) {
// if (instrument){instrumentStatement(content.expression)}
parse[content.expression.type](contract, content.expression);
};
@ -166,7 +152,6 @@ parse.VariableDeclaration = function parseVariableDeclaration(contract, expressi
console.log('more than one declaration');
}
parse[expression.declarations[0].id.type](contract, expression.declarations[0].id);
// parse[expression.declarations[0].init.type](contract, expression.declarations[0].init);
};
parse.UsingStatement = function parseUsingStatement(contract, expression) {

@ -3,7 +3,7 @@
"version": "0.0.1",
"description": "",
"bin": {
"solidity-coverage": "./exec.js"
"solidity-coverage": "./bin/exec.js"
},
"directories": {
"test": "test"

@ -16,7 +16,7 @@ function collectGarbage() {
describe('cli', () => {
let testrpcProcess = null;
const script = 'node ./exec.js';
const script = 'node ./bin/exec.js';
const port = 8555;
const config = {

@ -1,9 +1,9 @@
/* eslint-env node, mocha */
const path = require('path');
const getInstrumentedVersion = require('./../instrumentSolidity.js');
const getInstrumentedVersion = require('./../lib/instrumentSolidity.js');
const util = require('./util/util.js');
const CoverageMap = require('./../coverageMap');
const CoverageMap = require('./../lib/coverageMap');
const vm = require('./util/vm');
const assert = require('assert');

@ -1,7 +1,7 @@
/* eslint-env node, mocha */
const solc = require('solc');
const getInstrumentedVersion = require('./../instrumentSolidity.js');
const getInstrumentedVersion = require('./../lib/instrumentSolidity.js');
const util = require('./util/util.js');
const path = require('path');

@ -1,10 +1,10 @@
/* eslint-env node, mocha */
const solc = require('solc');
const getInstrumentedVersion = require('./../instrumentSolidity.js');
const getInstrumentedVersion = require('./../lib/instrumentSolidity.js');
const util = require('./util/util.js');
const path = require('path');
const CoverageMap = require('./../coverageMap');
const CoverageMap = require('./../lib/coverageMap');
const vm = require('./util/vm');
const assert = require('assert');

@ -1,9 +1,9 @@
/* eslint-env node, mocha */
const path = require('path');
const getInstrumentedVersion = require('./../instrumentSolidity.js');
const getInstrumentedVersion = require('./../lib/instrumentSolidity.js');
const util = require('./util/util.js');
const CoverageMap = require('./../coverageMap');
const CoverageMap = require('./../lib/coverageMap');
const vm = require('./util/vm');
const assert = require('assert');

@ -1,9 +1,9 @@
/* eslint-env node, mocha */
const path = require('path');
const getInstrumentedVersion = require('./../instrumentSolidity.js');
const getInstrumentedVersion = require('./../lib/instrumentSolidity.js');
const util = require('./util/util.js');
const CoverageMap = require('./../coverageMap');
const CoverageMap = require('./../lib/coverageMap');
const vm = require('./util/vm');
const assert = require('assert');

@ -1,7 +1,7 @@
/* eslint-env node, mocha */
const solc = require('solc');
const getInstrumentedVersion = require('./../instrumentSolidity.js');
const getInstrumentedVersion = require('./../lib/instrumentSolidity.js');
const util = require('./util/util.js');
describe('return statements', () => {

@ -1,9 +1,9 @@
/* eslint-env node, mocha */
const solc = require('solc');
const getInstrumentedVersion = require('./../instrumentSolidity.js');
const getInstrumentedVersion = require('./../lib/instrumentSolidity.js');
const util = require('./util/util.js');
const CoverageMap = require('./../coverageMap');
const CoverageMap = require('./../lib/coverageMap');
const path = require('path');
const vm = require('./util/vm');
const assert = require('assert');

@ -1,7 +1,7 @@
/* eslint-env node, mocha */
const solc = require('solc');
const getInstrumentedVersion = require('./../instrumentSolidity.js');
const getInstrumentedVersion = require('./../lib/instrumentSolidity.js');
const util = require('./util/util.js');
describe('Battery test of production contracts: OpenZeppelin', () => {

Loading…
Cancel
Save