From 9b67d8861ec9c5718461796bd1ce934bf5c8ffb6 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 30 May 2018 18:05:21 -0400 Subject: [PATCH 1/2] export tests lib sol code --- sol/{tests.sol => tests.sol.js} | 3 ++- src/index.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) rename sol/{tests.sol => tests.sol.js} (99%) diff --git a/sol/tests.sol b/sol/tests.sol.js similarity index 99% rename from sol/tests.sol rename to sol/tests.sol.js index 4fafe85392..2356f09100 100644 --- a/sol/tests.sol +++ b/sol/tests.sol.js @@ -1,3 +1,4 @@ +module.exports = ` pragma solidity ^0.4.7; library Assert { @@ -99,4 +100,4 @@ library Assert { //} } - +`; diff --git a/src/index.js b/src/index.js index e484b1ba01..8ae7143d06 100644 --- a/src/index.js +++ b/src/index.js @@ -188,5 +188,6 @@ var runTestFiles = function (filepath, isDirectory, web3) { module.exports = { runTestFiles: runTestFiles, runTestSources: runTestSources, - runTest: TestRunner.runTest + runTest: TestRunner.runTest, + assertLibCode: require('../sol/tests.sol.js') } From 82361713520c9c8ab22a35198f3b3373d99df874 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 30 May 2018 18:05:45 -0400 Subject: [PATCH 2/2] support remix_tests.sol reference --- src/compiler.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/compiler.js b/src/compiler.js index 1a414470cd..48d7a1f65a 100644 --- a/src/compiler.js +++ b/src/compiler.js @@ -10,7 +10,8 @@ function compileFileOrFiles (filename, isDirectory, cb) { let compiler, filepath const sources = { - 'tests.sol': {content: fs.readFileSync('sol/tests.sol').toString()} + 'tests.sol': {content: require('../sol/tests.sol.js') }, + 'remix_tests.sol': {content: require('../sol/tests.sol.js') } } // TODO: for now assumes filepath dir contains all tests, later all this @@ -48,6 +49,10 @@ function compileFileOrFiles (filename, isDirectory, cb) { function compileContractSources (sources, cb) { let compiler, filepath + if(!sources['remix_tests.sol']) { + sources['remix_tests.sol'] = {content: require('../sol/tests.sol.js')} + } + async.waterfall([ function loadCompiler (next) { compiler = new RemixCompiler()