parent
cd96d2feef
commit
954a1932f5
@ -0,0 +1,35 @@ |
||||
var test = require('tape') |
||||
var remixLib = require('remix-lib') |
||||
|
||||
var StatRunner = require('../../src/analysis/staticAnalysisRunner') |
||||
var compilerInput = remixLib.helpers.compiler.compilerInput |
||||
|
||||
var solc = require('solc/wrapper') |
||||
var compiler = solc(require('../../soljson')) |
||||
|
||||
var fs = require('fs') |
||||
var path = require('path') |
||||
|
||||
function compile (fileName) { |
||||
var content = fs.readFileSync(path.join(__dirname, 'test-contracts', fileName), 'utf8') |
||||
return JSON.parse(compiler.compileStandardWrapper(compilerInput(content))) |
||||
} |
||||
|
||||
test('staticAnalysisIssues.functionParameterPassingError', function (t) { |
||||
// https://github.com/ethereum/browser-solidity/issues/889#issuecomment-351746474
|
||||
t.plan(2) |
||||
var res = compile('functionParameters.sol') |
||||
|
||||
var module = require('../../src/analysis/modules/checksEffectsInteraction') |
||||
|
||||
var statRunner = new StatRunner() |
||||
|
||||
t.doesNotThrow(() => { |
||||
statRunner.runWithModuleList(res, [{ name: module.name, mod: new module.Module() }], (reports) => { |
||||
}) |
||||
}, true, 'Analysis should not throw') |
||||
|
||||
statRunner.runWithModuleList(res, [{ name: module.name, mod: new module.Module() }], (reports) => { |
||||
t.ok(!reports.some((mod) => mod.report.some((rep) => rep.warning.includes('INTERNAL ERROR')), 'Should not have internal errors')) |
||||
}) |
||||
}) |
@ -0,0 +1,16 @@ |
||||
pragma solidity ^0.4.18; |
||||
|
||||
contract B { |
||||
function plus(uint a, uint b) pure internal returns (uint) { |
||||
return a + b; |
||||
} |
||||
|
||||
function eval(function (uint, uint) pure internal returns (uint) f, uint x, uint y) pure internal returns (uint) { |
||||
return f(x, y); |
||||
} |
||||
|
||||
function calc(uint x, uint y) pure public returns (uint) { |
||||
return eval(plus, x, y); |
||||
// return plus(x, y); |
||||
} |
||||
} |
@ -1,7 +1,8 @@ |
||||
// require('./decoder/decodeInfo.js')
|
||||
// require('./decoder/storageLocation.js')
|
||||
require('./decoder/decodeInfo.js') |
||||
require('./decoder/storageLocation.js') |
||||
require('./decoder/storageDecoder.js') |
||||
// require('./decoder/localDecoder.js')
|
||||
require('./decoder/localDecoder.js') |
||||
|
||||
// require('./analysis/staticAnalysisCommon-test.js')
|
||||
// require('./analysis/staticAnalysisIntegration-test.js')
|
||||
require('./analysis/staticAnalysisCommon-test.js') |
||||
require('./analysis/staticAnalysisIntegration-test.js') |
||||
require('./analysis/staticAnalysisIssues-test.js') |
||||
|
Loading…
Reference in new issue