From 1f12ac18d7227c27c16bb1977d44415eee670962 Mon Sep 17 00:00:00 2001 From: William Entriken Date: Wed, 24 Oct 2018 20:03:23 -0400 Subject: [PATCH 1/3] Compile if solidity is fixed version, fixes #1011 --- remix-tests/src/compiler.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/remix-tests/src/compiler.js b/remix-tests/src/compiler.js index f43a9cab65..c65bdadeca 100644 --- a/remix-tests/src/compiler.js +++ b/remix-tests/src/compiler.js @@ -26,12 +26,12 @@ function compileFileOrFiles (filename, isDirectory, cb) { filepath = (isDirectory ? filename : path.dirname(filename)) fs.readdirSync(filepath).forEach(file => { - // only process .sol files - if (file.split('.').pop() === 'sol') { + // only process .sol files named *_test.sol + if (/_test.sol$/.test(file)) { let c = fs.readFileSync(path.join(filepath, file)).toString() const s = /^(import)\s['"](remix_tests.sol|tests.sol)['"];/gm - if (file.indexOf('_test.sol') > 0 && c.regexIndexOf(s) < 0) { - c = c.replace(/(pragma solidity \^\d+\.\d+\.\d+;)/, '$1\nimport \'remix_tests.sol\';') + if (!s.test(c)) { + c = c.replace(/(pragma solidity \^?\d+\.\d+\.\d+;)/, '$1\nimport \'remix_tests.sol\';') } sources[file] = { content: c } } From f5e81850de05a9a56940f08fb606ea23d207365d Mon Sep 17 00:00:00 2001 From: William Entriken Date: Wed, 24 Oct 2018 20:40:10 -0400 Subject: [PATCH 2/3] Easier fix --- remix-tests/src/compiler.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/remix-tests/src/compiler.js b/remix-tests/src/compiler.js index c65bdadeca..09a1f8f89e 100644 --- a/remix-tests/src/compiler.js +++ b/remix-tests/src/compiler.js @@ -26,16 +26,16 @@ function compileFileOrFiles (filename, isDirectory, cb) { filepath = (isDirectory ? filename : path.dirname(filename)) fs.readdirSync(filepath).forEach(file => { - // only process .sol files named *_test.sol - if (/_test.sol$/.test(file)) { + // only process .sol files + if (file.split('.').pop() === 'sol') { let c = fs.readFileSync(path.join(filepath, file)).toString() const s = /^(import)\s['"](remix_tests.sol|tests.sol)['"];/gm - if (!s.test(c)) { + if (file.indexOf('_test.sol') > 0 && c.regexIndexOf(s) < 0) { c = c.replace(/(pragma solidity \^?\d+\.\d+\.\d+;)/, '$1\nimport \'remix_tests.sol\';') } sources[file] = { content: c } } - }) + }) async.waterfall([ function loadCompiler (next) { From d56ed3c9d6ebd848bdfaf8ef182867925d15b4ea Mon Sep 17 00:00:00 2001 From: William Entriken Date: Wed, 24 Oct 2018 20:40:39 -0400 Subject: [PATCH 3/3] Update compiler.js --- remix-tests/src/compiler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remix-tests/src/compiler.js b/remix-tests/src/compiler.js index 09a1f8f89e..82c63a56f2 100644 --- a/remix-tests/src/compiler.js +++ b/remix-tests/src/compiler.js @@ -35,7 +35,7 @@ function compileFileOrFiles (filename, isDirectory, cb) { } sources[file] = { content: c } } - }) + }) async.waterfall([ function loadCompiler (next) {