From 9d2c032516cff51100663600bca8874c779386c1 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 3 Jan 2018 14:25:14 +0100 Subject: [PATCH] add tests --- remix-solidity/test/decoder/localDecoder.js | 4 +++- remix-solidity/test/decoder/stateTests/mapping.js | 9 ++++----- remix-solidity/test/decoder/vmCall.js | 3 +-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/remix-solidity/test/decoder/localDecoder.js b/remix-solidity/test/decoder/localDecoder.js index a3188b365e..53d5006a46 100644 --- a/remix-solidity/test/decoder/localDecoder.js +++ b/remix-solidity/test/decoder/localDecoder.js @@ -32,7 +32,9 @@ function test (st, vm, privateKey) { misc2LocalTest(st, vm, privateKey, output.contracts['test.sol']['miscLocal2'].evm.bytecode.object, output, function () { output = compiler.compileStandardWrapper(compilerInput(structArrayLocal.contract)) output = JSON.parse(output) - structArrayLocalTest(st, vm, privateKey, output.contracts['test.sol']['structArrayLocal'].evm.bytecode.object, output, function () {}) + structArrayLocalTest(st, vm, privateKey, output.contracts['test.sol']['structArrayLocal'].evm.bytecode.object, output, function () { + st.end() + }) }) }) }) diff --git a/remix-solidity/test/decoder/stateTests/mapping.js b/remix-solidity/test/decoder/stateTests/mapping.js index 3aac8010c5..15c654b6bf 100644 --- a/remix-solidity/test/decoder/stateTests/mapping.js +++ b/remix-solidity/test/decoder/stateTests/mapping.js @@ -17,12 +17,10 @@ module.exports = function testMappingStorage (st, cb) { } else { remixLib.global.web3.eth.getTransaction(txHash, (error, tx) => { if (error) { + console.log(error) st.end(error) } else { - testMapping(st, vm, privateKey, tx.contractAddress, output, (error) => { - st.end(error) - cb() - }) + testMapping(st, vm, privateKey, tx.contractAddress, output, cb) } }) } @@ -39,6 +37,7 @@ function testMapping (st, vm, privateKey, contractAddress, output, cb) { console.log(txHash) remixLib.global.web3.eth.getTransaction(txHash, (error, tx) => { if (error) { + console.log(error) st.end(error) } else { var TraceManager = require('remix-core').trace.TraceManager @@ -62,7 +61,7 @@ function testMapping (st, vm, privateKey, contractAddress, output, cb) { st.equal(result['_iBreakSolidityStateInt'].type, 'mapping(uint256 => uint256)') st.equal(result['_iBreakSolidityStateInt'].value['0000000000000000000000000000000000000000000000000000000000000001'].value, '1') st.equal(result['_iBreakSolidityStateInt'].value['0000000000000000000000000000000000000000000000000000000000000001'].type, 'uint256') - // st.end() + cb() }, (reason) => { console.log('fail') st.end(reason) diff --git a/remix-solidity/test/decoder/vmCall.js b/remix-solidity/test/decoder/vmCall.js index 0faf7a483a..4aa6f40b8b 100644 --- a/remix-solidity/test/decoder/vmCall.js +++ b/remix-solidity/test/decoder/vmCall.js @@ -3,6 +3,7 @@ var utileth = require('ethereumjs-util') var Tx = require('ethereumjs-tx') var Block = require('ethereumjs-block') var BN = require('ethereumjs-util').BN +var remixLib = require('remix-lib') function sendTx (vm, from, to, value, data, cb) { var tx = new Tx({ @@ -33,7 +34,6 @@ function sendTx (vm, from, to, value, data, cb) { Init VM / Send Transaction */ function initVM (st, privateKey) { - var remixLib = require('remix-lib') var utileth = require('ethereumjs-util') var VM = require('ethereumjs-vm') var Web3Providers = remixLib.vm.Web3Providers @@ -52,7 +52,6 @@ function initVM (st, privateKey) { st.fail(mes) } else { remixLib.global.web3 = obj - st.end() } }) return vm