From aa3bc256a2053f0c1f643f0776b54f93ba28acfe 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 45916fe9c45ea5986857d750662c9def9f3dc46e 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()